home *** CD-ROM | disk | FTP | other *** search
/ PC World 2007 March / PCWorld_2007-03_cd.bin / temacd / k-ninja / setup-kninja_v2.exe / {app} / defaults / profile / macros.cfg < prev    next >
Text File  |  2006-09-26  |  75KB  |  2,247 lines

  1. # MACROS DEFINITION FILE (http://kmeleon.sourceforge.net/wiki/index.php?id=MacroLanguage)
  2.  
  3. $activeX = "kmeleon.netplug.npmozax.dll";
  4. $macroPrefBranch="kmeleon.plugins.macros.";
  5. $macroResLoc="file:///".gsub("\\","/",getpref(STRING,"kmeleon.general.profileDir"))."chrome/";
  6.  
  7. # ----EVENT MACROS w/LAST SESSION & STARTUP GROUP SUPPORT----
  8. OnStartup{
  9. &SetLast;
  10. $layer=="true"? &SetNext:setpref(STRING,$og,$ln);
  11. getpref(INT,$sg)<2 ? "":$loaded="GroupStart"; &Sync;
  12. # for kmPrefs:
  13. getpref(BOOL,"kmeleon.plugins.favorites.load")==true?&getFavorites:"";
  14. }
  15.  
  16. OnLoad{
  17. $loaded==""?"":macros($loaded); &GetSetTemp; &Sync;
  18. }
  19.  
  20. OnCloseGroup{
  21. &GetSetTemp;
  22. }
  23.  
  24. OnActivateWindow{
  25. &EncodingSync;
  26. }
  27.  
  28. OnWMAppExit{
  29. &GetSetTemp;
  30. }
  31.  
  32. OnQuit{
  33. &SetLast; getpref(BOOL,$uar)!=true? delpref($ua):"";
  34. }
  35.  
  36. # ----BUTTON & MENU SYNC----
  37.  
  38. Sync{
  39. &EngineSync;
  40. &SpeedSync;
  41. &KeywordSync;
  42. &TAFSync;
  43. &GroupsSync;
  44. &ZoomSync;
  45. &UASync;
  46. &EncodingSync;
  47. &PrivacySync;
  48. &ProxySync;
  49. &BookSync;
  50. &LayerSync;
  51. &MGSync;
  52. &LayersSync;
  53. setcheck("macros(Active_X)",getpref(BOOL,$activeX));
  54. setcheck("macros(FrmToggle)",getpref(BOOL,$frames)? false:true);
  55. }
  56.  
  57.  
  58. # ---- PAGESPEED MACRO
  59.  
  60. # TOGGLE PAGESPEED
  61.  
  62. ToggleSpeed{
  63. menu = "Enable Fast Webpage Display"
  64. getpref(BOOL, "network.http.pipelining") == true ? &DisableSpeed:&EnableSpeed;
  65. &Sync;
  66. getpref(BOOL, "network.http.pipelining") == true ? $warn = "enabled":$warn = "disabled";
  67. Alert("Fast Webpage Display has been ".$warn."!", "K-Ninja Speed Settings");
  68. }
  69.  
  70. # ENABLE PAGESPEED
  71.  
  72. EnableSpeed{
  73. # TURN ON TIMER BASED REFLOW MANAGEMENT
  74. setpref(BOOL, "content.notify.ontimer", true);
  75.  
  76. # SETS THE ALLOWED TIME BETWEEN REFLOWS IN MICROSECONDS
  77. setpref(INT, "content.notify.interval", 240000);
  78.  
  79. # SET THE NUMBER OF REFLOWS TO DO BEFORE WAITING FOR THE REST OF THE PAGE TO ARRIVE
  80. setpref(INT, "content.notify.backoffcount", 10);
  81.  
  82. # ENABLE IMPROVED PIPELINING
  83. setpref(BOOL, "network.http.pipelining", true);
  84. setpref(INT, "network.http.pipelining.maxrequests", 8);
  85. setpref(BOOL, "network.http.proxy.pipelining", true);
  86.  
  87. # INCREASE MULTI-THREADED DOWNLOAD PERFORMANCE
  88. setpref(INT, "network.http.max-connections", 24);
  89. setpref(INT, "network.http.max-connections-per-server", 16);
  90. setpref(INT, "network.http.max-persistent-connections-per-proxy", 8);
  91. setpref(INT, "network.http.max-persistent-connections-per-server", 4);
  92. }
  93. DisableSpeed{
  94. setpref(BOOL, "content.notify.ontimer", false);
  95. setpref(INT, "content.notify.interval", 120000);
  96. setpref(INT, "content.notify.backoffcount", -1);
  97. setpref(BOOL,"network.http.pipelining", false);
  98. setpref(INT, "network.http.pipelining.maxrequests", 4);
  99. setpref(BOOL, "network.http.proxy.pipelining", false);
  100. setpref(INT, "network.http.max-connections", 24);
  101. setpref(INT, "network.http.max-connections-per-server", 8);
  102. setpref(INT, "network.http.max-persistent-connections-per-proxy", 4);
  103. setpref(INT, "network.http.max-persistent-connections-per-server", 2);
  104. }
  105.  
  106. SpeedSync{
  107. setcheck("macros(ToggleSpeed)", getpref(BOOL, "network.http.pipelining") == true ? true:false);
  108. }
  109.  
  110.  
  111. # ---- Encoding ----
  112.  
  113. $Pref_charsetdet = "intl.charset.detector";
  114. $charset_current = "iso-8859-1";
  115.  
  116. EncodingSync{
  117. $detector=getpref(STRING,$Pref_charsetdet);
  118. setcheck("macros(AutoDetect())",$detector==""? true:false);
  119. setcheck("macros(AutoDetect(universal_charset_detector))",$detector=="universal_charset_detector"? true:false);
  120. setcheck("macros(AutoDetect(zh_parallel_state_machine))",$detector=="zh_parallel_state_machine"? true:false);
  121. setcheck("macros(AutoDetect(ja_parallel_state_machine))",$detector=="ja_parallel_state_machine"? true:false);
  122. setcheck("macros(AutoDetect(ko_parallel_state_machine))",$detector=="ko_parallel_state_machine"? true:false);
  123. setcheck("macros(AutoDetect(cjk_parallel_state_machine))",$detector=="cjk_parallel_state_machine"? true:false);
  124. setcheck("macros(AutoDetect(ruprob))",$detector=="ruprob"? true:false);
  125. setcheck("macros(AutoDetect(ukprob))",$detector=="ukprob"? true:false);
  126.  
  127. # getcharset and global vars are dependent of the current active window,
  128. # not on the window which triggered the onload macro. Thank to this bug
  129. # the following work.
  130. $__temp = "macros(ForceCharset(" . $charset_current . "))";
  131. setcheck($__temp, false);
  132. $charset_current = $CHARSET;
  133. $__temp = "macros(ForceCharset(" . $charset_current . "))";
  134. setcheck($__temp, true);
  135. }
  136.  
  137. AutoDetect {
  138. setpref(STRING,"intl.charset.detector",$ARG); forcecharset();
  139. }
  140.  
  141. ForceCharset {
  142. forcecharset($ARG);
  143. }
  144.  
  145. # ----ENGINES---- 
  146.  
  147. Dogpile{
  148. &OldSearch; $search = "Dogpile";
  149. $eng = "http://www.dogpile.com/info.dogpl/search/web/"; 
  150. &SetSearch;
  151. }
  152.  
  153. Google{
  154. &OldSearch; $search = "Google";
  155. $eng = "http://www.scroogle.org/cgi-bin/nbbw.cgi?Gw="; 
  156. &SetSearch;
  157. }
  158.  
  159. Hakia{
  160. &OldSearch; $search = "Hakia";
  161. $eng = "http://www.hakia.com/search.aspx?q=";
  162. &SetSearch;
  163. }
  164.  
  165. Yahoo{
  166. &OldSearch; $search = "Yahoo";
  167. $eng = "http://search.yahoo.com/bin/search?p=";
  168. &SetSearch;
  169. }
  170.  
  171. Dictionaries{
  172. &OldSearch; $search = "Dictionaries (One Look)";
  173. $eng = "http://www.onelook.com/?w=";
  174. &SetSearch;
  175. }
  176.  
  177. Wikipedia{
  178. &OldSearch; $search = "Wikipedia"; 
  179. $eng = "http://en.wikipedia.org/wiki/";
  180. &SetSearch;
  181. }
  182.  
  183. KM{
  184. &OldSearch; $search = "K-Meleon Forums"; 
  185. $eng = "http://kmeleon.sourceforge.net/forum/search.php?f=3&globalsearch=1&match=1&date=0&fldsubject=1&fldbody=1&search="; 
  186. &SetSearch;
  187. }
  188.  
  189. URL{
  190. &OldSearch; $search = "URL"; $eng = ""; &Locked;
  191. }
  192.  
  193. EngineSync{
  194. setcheck("macros(Dogpile)", getpref(STRING, $sen) == "Dogpile" ? true:false);
  195. setcheck("macros(Google)", getpref(STRING, $sen) == "Google" ? true:false);
  196. setcheck("macros(Hakia)", getpref(STRING, $sen) == "Hakia" ? true:false);
  197. setcheck("macros(Yahoo)", getpref(STRING, $sen) == "Yahoo" ? true:false);
  198. setcheck("macros(Dictionaries)", getpref(STRING, $sen) == "Dictionaries (One Look)" ? true:false);
  199. setcheck("macros(Wikipedia)", getpref(STRING, $sen) == "Wikipedia" ? true:false);
  200.  
  201. setcheck("macros(SN0)",getpref(INT,$so)==0? true:false);
  202. setcheck("macros(SN1)",getpref(INT,$so)==1? true:false);
  203. setcheck("macros(SN2)",getpref(INT,$so)==2? true:false);
  204. setcheck("macros(SearchLock)",getpref(BOOL,$sl));
  205. setcheck("macros(cookiewarn)", getpref(BOOL, "network.cookie.warnAboutCookies") == true ? true:false);
  206. }
  207.  
  208.  
  209.  
  210. # ----SEARCH MACROS----
  211.  
  212. $sm=$macroPrefBranch."search.meta";
  213. $se="kmeleon.general.searchEngine";
  214. $sl=$macroPrefBranch."search.locked";
  215. $sen=$macroPrefBranch."search.engineName";
  216. $so=$macroPrefBranch."search.open";
  217. $eng=getpref(STRING, $se) ;
  218. $search=getpref(STRING, $sen);
  219. $layers="kmeleon.plugins.layers.load";
  220. $layer=getpref(BOOL, $layers);
  221.  
  222.  
  223. OldSearch{
  224. $oldeng=$eng; $oldsearch=$search;
  225. }
  226.  
  227. SetSearch{
  228. getpref(BOOL,$sl)==false ? &Unlocked:&Locked; &EngineSync;
  229. }
  230. Unlocked{
  231. setpref(STRING,$sen,$search); setpref(STRING,$se,$eng); &Search;
  232. }
  233. Locked{
  234. &Search; $search=$oldsearch; $eng=$oldeng;
  235. }
  236. Search{
  237. $word=$SelectedText;
  238. $word=="" ? &URLBarSearch:$word==$URL ? &PromptSearch:&OpenSearch; 
  239. }
  240. URLBarSearch{
  241. $word=$URLBAR
  242. $word=="" ? $word=$URL:""; $word==$URL ? &PromptSearch:&OpenSearch;
  243. }
  244. PromptSearch{
  245. $search=="" ? $search="Google":0;
  246. $search=="URL" ? $tip="Enter URL:":$tip=sub("%s", $search, _("Search %s for:"));
  247. $word=prompt($tip,$search); $word==""?"": &OpenSearch;
  248. }
  249. OpenSearch{
  250. $how=getpref(INT, $so); $search!="Google"?"": $word=urlencode($word);
  251. $how==0 ? open($eng.$word):$how==1 ? &SearchNew:$how==2 ? &SearchBack:0;
  252. }
  253. Umlauts{
  254. $word=gsub("Σ","%C3%A4",$word); $word=gsub("÷","%C3%B6",$word); $word=gsub("ⁿ","%C3%BC",$word); $word=gsub("▀","%C3%9F",$word); $word=gsub("─","%C3%84",$word); $word=gsub("╓","%C3%96",$word); $word=gsub("▄","%C3%9C",$word);
  255.  
  256. $word=gsub("└","%C3%80",$word); $word=gsub("┬","%C3%82",$word);
  257. $word=gsub("α","%C3%A0",$word); $word=gsub("Γ","%C3%A2",$word);
  258. $word=gsub("τ","%C3%A7",$word); $word=gsub("Φ","%C3%A8",$word);
  259. $word=gsub("╦","%C3%8B",$word); $word=gsub("Ω","%C3%AA",$word);
  260. $word=gsub("Θ","%C3%A9",$word); $word=gsub("δ","%C3%AB",$word);
  261. $word=gsub("╔","%C3%89",$word); $word=gsub("╚","%C3%88",$word);
  262. $word=gsub("╧","%C3%8F",$word); $word=gsub("∩","%C3%AF",$word);
  263. $word=gsub("ε","%C3%AE",$word); $word=gsub("±","%C3%B1",$word);
  264. $word=gsub("⌠","%C3%B4",$word); $word=gsub("√","%C3%BB",$word);
  265. $word=gsub("∙","%C3%B9",$word); $word=gsub("┘","%C3%99",$word);
  266. }
  267. SearchNew{
  268. &ResetURL; $layer==true ? pluginmsg(layers,"OpenURL",$eng.$word):opennew($eng.$word);
  269. }
  270. ResetURL{
  271. $URLBAR = $URL;
  272. }
  273. SearchBack{
  274. &ResetURL; $layer==true ? pluginmsg(layers,"OpenURLBg",$eng.$word):OpenBg($eng.$word);
  275. }
  276.  
  277. PasteSearch{
  278. $URLBAR=getclipboard(); &Search;
  279. }
  280.  
  281. SN0{
  282. setpref(INT,$so,0); &EngineSync;
  283. }
  284. SN1{
  285. setpref(INT,$so,1); &EngineSync;
  286. }
  287. SN2{
  288. setpref(INT,$so,2); &EngineSync;
  289. }
  290.  
  291. SearchLock{
  292. $search==""? $search="Google":0; togglepref(BOOL,$sl);
  293. #getpref(BOOL,$sl)==true ? $how="LOCKED on: ".$search:$how="UNLOCKED";
  294. #alert("The default Search Engine is now ".$how."\n\n\nTo set default engine\(for MultiSearch not possible):\n\n1. Unlock\n2. Click desired engine from menu\n3. Lock",_("Search Button"),INFO);
  295. &EngineSync;
  296. }
  297.  
  298. AddEng{
  299. $theurl="http://kmeleon.sourceforge.net/wiki/index.php?id=Search+Engines";
  300. $layer=="true"? pluginmsg(layers,"OpenURL",$theurl):opennew($theurl);
  301. $loaded="MacMen";
  302. }
  303. MacMen{
  304. &Macros; &Menus; $loaded="";
  305. }
  306.  
  307. Highlight{
  308. InjectJS("(function(){var count=0, text, dv;text=prompt(\"Find and Highlight the following:\", \"\");if(text==null || text.length==0)return;dv=document.defaultView;function searchWithinNode(node, te, len){var pos, skip, spannode, middlebit, endbit, middleclone;skip=0;if( node.nodeType==3 ){pos=node.data.toUpperCase().indexOf(te);if(pos>=0){spannode=document.createElement(\"SPAN\");spannode.style.backgroundColor=\"yellow\";middlebit=node.splitText(pos);endbit=middlebit.splitText(len);middleclone=middlebit.cloneNode(true);spannode.appendChild(middleclone);middlebit.parentNode.replaceChild(spannode,middlebit);++count;skip=1;}}else if( node.nodeType==1&& node.childNodes&& dv.getComputedStyle(node, null).getPropertyValue(\"display\")!=\"none\"){for (var child=0; child < node.childNodes.length; ++child){child=child+searchWithinNode(node.childNodes[child], te, len);}}return skip;}window.status=\"Searching for '\"+text+\"'...\";searchWithinNode(document.body, text.toUpperCase(), text.length);window.status=\"Found \"+count+\" occurrence\"+(count==1?\"\":\"s\")+\" of '\"+text+\"'.\";})();");
  309. }
  310.  
  311. # ----- KEYWORD -----
  312.  
  313. KeywordSync{
  314. setcheck("macros(Keyword)",getpref(BOOL,"keyword.enabled"));
  315. setcheck("macros(KeyEngBBN)",getpref(STRING,"keyword.eng")=="BBN"? true:false);
  316. setcheck("macros(KeyEngIFL)",getpref(STRING,"keyword.eng")=="IFL"? true:false);
  317. setcheck("macros(KeyEngGoog)",getpref(STRING,"keyword.eng")=="GOOG"? true:false);
  318. setcheck("macros(KeyConfig)",getpref(STRING,"keyword.eng")==""? true:false);
  319. }
  320.  
  321. Keyword{
  322. togglepref(BOOL,"keyword.enabled"); &KeywordSync;
  323. }
  324.  
  325. CheckKey{
  326. $eng=getpref(STRING,"keyword.URL");
  327. }
  328. KeyEngBBN{
  329. $eng=_("http://www.google.com/search?gfns=1&q=");
  330. $string="BBN"; &KeyEng;
  331. }
  332. KeyEngIFL{
  333. $eng=_("http://www.google.com/search?btnI=1&q=");
  334. $string="IFL"; &KeyEng;
  335. }
  336. KeyEngGoog{
  337. $eng=_("http://www.google.com/search?q=");
  338. $string="GOOG"; &KeyEng;
  339. }
  340. KeyConfig{
  341. &CheckKey; $eng=prompt( _("Enter Keyword Autosearch Engine:"), _("Keyword Autosearch"), $eng)
  342. $eng==""?"":$string=""; $eng==""?"": &KeyEng;
  343. }
  344. KeyEng{
  345. setpref(STRING,_("keyword.URL"),$eng); setpref(STRING,"keyword.eng",$string); &Sync;
  346. alert( sub("%s", $eng, _("Keyword Autosearch Engine =  '%s'")), _("Keyword Autosearch Engine"),INFO);
  347. }
  348.  
  349. # ----- URL Handling
  350.  
  351. $openTyped="kmeleon.general.openurl";
  352. $openSelected=$macroPrefBranch."selected.openurl";
  353. $openSync=true;
  354.  
  355. # ----- Toggle Cookie Warnings
  356.  
  357. cookiewarn{
  358.    menu = "Enable Cookie Warnings"
  359.    togglepref(BOOL, "network.cookie.warnAboutCookies");
  360.    &Sync;
  361.    getpref(BOOL, "network.cookie.warnAboutCookies") == true ? $warn = "enabled" :$warn = "disabled";
  362.    alert("Cookie warnings have been ".$warn."!");
  363. }
  364.  
  365.  
  366. # ----- TYPEAHEAD ----
  367.  
  368. $taf="accessibility.typeaheadfind";
  369.  
  370.  
  371. TAFSync{
  372. setcheck("macros(TAF)",getpref(BOOL,$taf));
  373. setcheck("macros(TAFAuto)",getpref(BOOL,$taf.".autostart"));
  374. setcheck("macros(TAFLinks)", getpref(BOOL,$taf.".linksonly"));
  375. }
  376.  
  377. TAF{
  378. togglepref(BOOL,$taf); &TAFSync;
  379. }
  380. TAFAuto{
  381. togglepref(BOOL,$taf.".autostart");
  382. $var=getpref(BOOL,$taf.".autostart")==true ? $tip=_("Find As You Type Auto Start") . " - "._("ENABLED") : $tip=_("Find As You Type Auto Start") . " - "._("DISABLED") : 
  383. $tip="Find As You Type Auto Start"; 
  384. &Sync;statusbar($tip);
  385. }
  386.  
  387. TAFLinks{
  388. togglepref(BOOL,$taf.".linksonly");
  389. #$var=getpref(BOOL,$taf.".linksonly")==true ? $bool=_(" - ENABLED. Only links will be searched for as you start typing. You can override this by pressing  /  for all text, or  '  for links only."):$bool=_(" - DISABLED ");
  390. $var=getpref(BOOL,$taf.".autostart")==true ? $tip=_("Find As You Type Links Only") . " - "._("ENABLED") : $tip=_("Find As You Type Links Only") . " - "._("DISABLED") : 
  391. $tip=_("Find As You Type Links Only");
  392. &Sync;statusbar($tip);
  393. }
  394. AlertTAF{
  395. alert($tip.$bool,$tip,INFO);
  396. }
  397.  
  398. # ----- JavaScript -----
  399.  
  400. JSEnable {
  401. getpref(BOOL,$jscript)==false ? &JS:macros($macro);
  402. }
  403. JS{
  404. &JSToggle; macros($macro); &JSToggle;
  405. }
  406.  
  407.  
  408. # ----- JavaScript Document Handling
  409.  
  410. $JSdoit="";
  411. $JSfunc="";
  412. $JSlast="";
  413.  
  414. hndlDoc{
  415. InjectJS($JSfunc."with(document){".$JSdoit."}".$JSlast,"frame");
  416. $JSdoit="";
  417. $JSfunc="";
  418. $JSlast="";
  419. }
  420.  
  421. hndlDocs{
  422. # $JSfunc is the right place for functions and global variables (e.g. when you want to count something over all frames)
  423. # $JSlast is the right place for finishing actions (e.g. when you want to alert what you have counted over all frames)
  424. InjectJS($JSfunc."function hndlFrm(w){try{with(w.document){".$JSdoit."}}catch(e){}for(var j=0,f=w.frames;j<f.length;j++)hndlFrm(f[j])}hndlFrm(window);".$JSlast);
  425. $JSdoit="";
  426. $JSfunc="";
  427. $JSlast="";
  428. }
  429.  
  430. # ----- Scroll macros
  431.  
  432. scrollToTop{
  433. $JSdoit="scroll(0,0x00000)"; &hndlDoc;
  434. }
  435. scrollToBottom{
  436. $JSdoit="scroll(0,0x10000)"; &hndlDoc;
  437. }
  438. scrollToLeftEnd{
  439. $JSdoit="scrollBy(-0x10000,0)"; &hndlDoc;
  440. }
  441. scrollToRightEnd{
  442. $JSdoit="scrollBy( 0x10000,0)"; &hndlDoc;
  443. }
  444.  
  445. # ----IMAGE & ZOOM MACROS----
  446.  
  447. ViewImages{
  448. $JSfunc="with(document)var ext=new Array('bmp','gif','giff','jpg','jpeg','png','ico'),imgWin=open('','kmIMG'+Math.floor(Math.random()*1000),''),nlf='<p>"._("No linked images found.")."</p>',tit='"._("Linked Images:")." '+((title)?title:unescape(URL)),txt='';";
  449. $JSdoit="if(getElementsByTagName('body')[0]){txt+='<fieldset><legend>'+((title)?title:unescape(URL)).link(URL)+'</legend><ol>';if(links.length){var l=0;for(var j=0;j<links.length;j++)for(var k=0,x=(''+links[j]).split('.');k<ext.length;k++)if(x[x.length-1].toLowerCase()==ext[k]){txt+='<li><img src=\"'+links[j]+'\"></li>';l++}if(!l)txt+=nlf}else txt+=nlf;txt+='</ol></fieldset>'}";
  450. $JSlast="with(imgWin.document){write('<head><title>'+tit+'</title><link rel=\"stylesheet\" type=\"text/css\" href=\"'+encodeURI('".$macroResLoc."')+'macros.css\"></head><body class=\"kmLinkedImages\">');write(txt+'</body>');close()}";
  451. &hndlDocs;
  452. }
  453.  
  454. LinkedImages{
  455. $macro="ViewImages";&PBDisable;
  456. }
  457.  
  458. hndlImg{
  459. $JSdoit="var b=getElementsByTagName('body')[0];if(b){var bz=(b.getAttribute('zoom')==null)?1:(b.getAttribute('zoom')/10);for(var j=0,i=images;j<i.length;j++)with(i[j])if(encodeURIComponent(src).replace(/%25([A-F0-9]{2})/g,'%$1')=='".urlencode($ImageURL)."'){".$JSdoitImg."}}"; &hndlDoc;
  460. }
  461. hndlImgs{
  462. $JSdoit="var b=getElementsByTagName('body')[0];if(b){if(b.getAttribute('zoom')==null)b.setAttribute('zoom',10);var bz=".$zoomBy.",o=parseFloat(b.getAttribute('zoom'));if(Math.round(bz+o)){b.setAttribute('zoom',Math.round(bz+o));bz=b.getAttribute('zoom')/10;for(var j=0,i=images;j<i.length;j++)with(i[j]){".$JSdoitImg."}}}"; $JSfunc=""; &hndlDocs;
  463. }
  464. zoomImg{
  465. $JSdoitImg="if(getAttribute('zoom')==null){setAttribute('initW',width);setAttribute('initH',height);setAttribute('zoom',1)}var iz=".$zoomBy.";setAttribute('zoom',getAttribute('zoom')*iz);iz=getAttribute('zoom');width=bz*iz*getAttribute('initW');height=bz*iz*getAttribute('initH')"; &hndlImg;
  466. }
  467.  
  468. zoomTxt{
  469. $JSdoit="var b=getElementsByTagName('body')[0];if(b)zoomNode(b,(10+".$zoomBy.")/10);"; $JSfunc="function zoomNode(n,z){for(var j=0;j<n.childNodes.length;j++)if(n.childNodes[j].nodeType==1)zoomNode(n.childNodes[j],z);var lh=getComputedStyle(n,'').getPropertyValue('line-height');if(lh!='normal')n.style.lineHeight=Math.round(parseFloat(lh.replace(/px/,''))*z)+'px';n.style.fontSize=Math.round(parseFloat(getComputedStyle(n,'').getPropertyValue('font-size').replace(/px/,''))*z)+'px'}"; &hndlDocs;
  470. }
  471.  
  472. zoomImgs{
  473. $JSdoitImg="var iz=(getAttribute('zoom')==null)?1:getAttribute('zoom');if(getAttribute('initW')==null){setAttribute('initW',width);setAttribute('initH',height)}width=bz*iz*getAttribute('initW');height=bz*iz*getAttribute('initH')"; &hndlImgs;
  474. }
  475. ImageInfo{
  476. $JSdoitImg="var l=getAttribute('longdesc'),s='"._("Image Properties")."\\n\\n"._("URL:").\\t."'+unescape(src)+'\\n"._("Size:\\t%W x %H Pixels")."'.replace(/%W/,width).replace(/%H/,height);if(alt)s+='\\n"._("Alt. Text:\\t")."'+alt;if(l){s+='\\n\\n"._("A description is available for this image. Do you want to view it?")."';if(confirm(s)){if(top.location==self.location)open(l);top.location.href=l}}else alert(s)"; &hndlImg;
  477. }
  478.  
  479. ImgInfo {
  480. $FrameURL=""; $PageURL=$FrameURL;
  481. open("javascript: function chkframes(elem) { var rep; if (unescape(elem.location) == '".$PageURL."' || '".$PageURL."'=='') { rep=chkimg(elem); if (rep) return rep; } for (var f=0; f<elem.frames.length; f++) { rep=chkframes(elem.frames[f]); if (rep) return rep; } return; } function chkimg(elem){ if(elem.document.images.length>0){ var i; for(i=0;i<elem.document.images.length;i++){ if(unescape(elem.document.images[ i ].src) == '".$ImageURL."'){ return elem.document.images[i]; } } } } function XyZ() { var img=chkframes(window); if (img) { alert(\"* I M A G E   P R O P E R T I E S *\\r\\n\\r\\nURL:\\t\" + unescape(img.src) + \"\\r\\nWidth:\\t\" + img.width + \"\\r\\nHeight:\\t\" + img.height + \"\\r\\nALT:\\t\" + img.alt  + \"\\r\\nTitle:\\t\" + img.title); } } void(XyZ()); ");
  482. }
  483.  
  484. ImageCache{
  485. $i=index($ImageURL,"#");
  486. $addr=$i==-1 ? $ImageURL:substr($ImageURL,0,$i);
  487. $client=index($addr,"https://")==0 ? "HTTP-memory-only":"HTTP";
  488. $var="about:cache-entry?client=".$client."&sb=1&key=".$addr;
  489. index($addr,"http")==0 ? opennew($var):"";
  490. }
  491.  
  492. ZoomInImage{
  493. $FrameURL=""; $PageURL=$FrameURL;
  494. $zoomBy="2"; &zoomImg;
  495. }
  496. ZoomInImg{
  497. $FrameURL=""; $PageURL=$FrameURL;
  498. open("javascript:function chkframes(elem) { var rep; if (unescape(elem.location) == '".$PageURL."' || '".$PageURL."'=='') { rep=chkimg(elem); if (rep) return rep; } for (var f=0; f<elem.frames.length; f++) { rep=chkframes(elem.frames[f]); if (rep) return rep; } return; } function chkimg(elem){ if(elem.document.images.length>0){ var i; for(i=0;i<elem.document.images.length;i++){ if(unescape(elem.document.images[ i ].src) == '".$ImageURL."'){ return elem.document.images[i]; } } } } function zoomImage(image, amt) { if(image.initialHeight == null) { /* avoid losing height information due to integer rounding while zooming out */ image.initialHeight = image.height; image.initialWidth = image.width; image.scalingFactor = 1; } image.scalingFactor *= amt; image.width = image.scalingFactor * image.initialWidth; image.height = image.scalingFactor * image.initialHeight; } function findIMG() { var img=chkframes(window); zoomImage(img,2); } void(findIMG());");
  499. }
  500.  
  501. ZoomOutImage{
  502. $zoomBy="1/2"; &zoomImg;
  503. }
  504. ZoomOutImg {
  505. $FrameURL=""; $PageURL=$FrameURL;
  506. open("javascript:function chkframes(elem) { var rep; if (unescape(elem.location) == '".$PageURL."' || '".$PageURL."'=='') { rep=chkimg(elem); if (rep) return rep; } for (var f=0; f<elem.frames.length; f++) { rep=chkframes(elem.frames[f]); if (rep) return rep; } return; } function chkimg(elem){ if(elem.document.images.length>0){ var i; for(i=0;i<elem.document.images.length;i++){ if(unescape(elem.document.images[ i ].src) == '".$ImageURL."'){ return elem.document.images[i]; } } } } function zoomImage(image, amt) { if(image.initialHeight == null) { /* avoid losing height information due to integer rounding while zooming out */ image.initialHeight = image.height; image.initialWidth = image.width; image.scalingFactor = 1; } image.scalingFactor *= amt; image.width = image.scalingFactor * image.initialWidth; image.height = image.scalingFactor * image.initialHeight; } function findIMG() { var img=chkframes(window); zoomImage(img,.5); } void(findIMG());");
  507. }
  508.  
  509. ZoomInImages{
  510. $zoomBy="1"; &zoomImgs;
  511. }
  512. ZoomInImgs{
  513. open("javascript:(function(){ function zoomImage(image, amt) { if(image.initialHeight == null) { /* avoid losing height information due to integer rounding while zooming out */ image.initialHeight = image.height; image.initialWidth = image.width; image.scalingFactor = 1; } image.scalingFactor *= amt; image.width = image.scalingFactor * image.initialWidth; image.height = image.scalingFactor * image.initialHeight; } for (i=0; i<document.images.length; ++i) zoomImage(document.images[i], 1.1); })();");
  514. }
  515.  
  516. ZoomOutImages{
  517. $zoomBy="-1"; &zoomImgs;
  518. }
  519. ZoomOutImgs{
  520. open("javascript:(function(){ function zoomImage(image, amt) { if(image.initialHeight == null) { /* avoid losing height information due to integer rounding while zooming out */ image.initialHeight = image.height; image.initialWidth = image.width; image.scalingFactor = 1; } image.scalingFactor *= amt; image.width = image.scalingFactor * image.initialWidth; image.height = image.scalingFactor * image.initialHeight; } for (i=0; i<document.images.length; ++i) zoomImage(document.images[i], .9092); })();");
  521. }
  522.  
  523. ZoomImageLinks{
  524. $macro="ZoomImgLinks"; &JSEnable;
  525. }
  526. ZoomImgLinks{
  527. open("javascript:{var hrefs=document.getElementsByTagName('A'),images='';for(idx=0;idx<hrefs.length;idx++){href=hrefs[idx].href.toUpperCase(); if(href.indexOf('.GIF')>-1||href.indexOf('.BMP')>-1||href.indexOf('.JPEG')>-1||href.indexOf('.JPG')>-1||href.indexOf('.PNG')>-1)images+='<img src='+hrefs[idx]+'><br><br>';}images='<html><body><center><h2>Images</h2><br><br>'+images+'</center></body></html>';document.write(images);document.close();}");
  528. }
  529.  
  530. ZoomInPage2{
  531. $zoomBy="1"; &zoomImgs; &zoomTxt;
  532. }
  533.  
  534. ZoomOutPage2{
  535. $zoomBy="-1"; &zoomImgs; &zoomTxt;
  536. }
  537.  
  538. ZoomInPage{
  539. $zoomBy="1"; &zoomImgs; id(ID_FONT_INCREASE);
  540. }
  541. ZoomInPg{
  542. open("javascript:function zoomImage(image, amt) { if(image.initialHeight == null) {image.initialHeight = image.height; image.initialWidth = image.width; image.scalingFactor = 1; } image.scalingFactor *= amt; image.width = image.scalingFactor * image.initialWidth; image.height = image.scalingFactor * image.initialHeight; }function rZoomFont(n, node) {for ( var i = 0; i < node.childNodes.length; i++ ) {if (node.childNodes[i].nodeType == 1) rZoomFont(n, node.childNodes[i]);}startSize = getComputedStyle(node,'').getPropertyValue('font-size');startSize = Number(startSize.substr(0,startSize.length-2));lh = getComputedStyle(node,'').getPropertyValue('line-height');if (lh != 'normal') {lh = Number(lh.substr(0,lh.length-2)) * n + 'px';node.style.lineHeight = lh;}newSize = (startSize * n) + 'px';node.style.fontSize = newSize;}rZoomFont(1.1,document.getElementsByTagName('body')[0]); for (i=0; i<document.images.length; ++i) zoomImage(document.images[i], 1.1);");
  543. }
  544.  
  545. ZoomOutPage{
  546. $zoomBy="-1"; &zoomImgs; id(ID_FONT_DECREASE);
  547. }
  548. ZoomOutPg{
  549. open("javascript:function zoomImage(image, amt) { if(image.initialHeight == null) {image.initialHeight = image.height; image.initialWidth = image.width; image.scalingFactor = 1; } image.scalingFactor *= amt; image.width = image.scalingFactor * image.initialWidth; image.height = image.scalingFactor * image.initialHeight; }function rZoomFont(n, node) {for ( var i = 0; i < node.childNodes.length; i++ ) {if (node.childNodes[i].nodeType == 1) rZoomFont(n, node.childNodes[i]);}startSize = getComputedStyle(node,'').getPropertyValue('font-size');startSize = Number(startSize.substr(0,startSize.length-2));lh = getComputedStyle(node,'').getPropertyValue('line-height');if (lh != 'normal') {lh = Number(lh.substr(0,lh.length-2)) * n + 'px';node.style.lineHeight = lh;}newSize = (startSize * n) + 'px';node.style.fontSize = newSize;}rZoomFont(0.9092,document.getElementsByTagName('body')[0]); for (i=0; i<document.images.length; ++i) zoomImage(document.images[i], .9092);");
  550. }
  551.  
  552. $zoom="kmeleon.general.zoomButtons";
  553.  
  554. ZoomSync{
  555. setcheck("macros(ZoomPage)",getpref(STRING,$zoom)==""? true:false);
  556. setcheck("macros(ZoomText)",getpref(STRING,$zoom)=="text"? true:false);
  557. setcheck("macros(ZoomImages)",getpref(STRING,$zoom)=="images"? true:false);
  558. }
  559.  
  560. ZoomSet{
  561. setpref(STRING,$zoom,$var); &Sync;
  562. alert($what,Zoom Toolbar Buttons,INFO);
  563. }
  564. ZoomText{
  565. $var="text"; $what=_("Zoom In/Out toolbar buttons will effect text only."); &ZoomSet;
  566. }
  567. ZoomImages{
  568. $var="images"; $what=_("Zoom In/Out toolbar buttons will effect images only."); &ZoomSet;
  569. }
  570. ZoomPage{
  571. $var=""; $what=_("Zoom In/Out toolbar buttons will effect both images and text."); &ZoomSet;
  572. }
  573.  
  574. ZoomIn{
  575. $zi=getpref(STRING,$zoom); $zi==""? &ZoomInPage:$zi=="text"? id(ID_FONT_INCREASE):&ZoomInImages;
  576. }
  577. ZoomInCheck{
  578. $zi=="text"? id(ID_FONT_INCREASE):&ZoomInImages;
  579. }
  580.  
  581. ZoomOut{
  582. $zo=getpref(STRING,$zoom); $zo==""? &ZoomOutPage:$zo=="text"? id(ID_FONT_DECREASE):&ZoomOutImages;
  583. }
  584. ZoomOutCheck{
  585. $zo=="text"? id(ID_FONT_DECREASE):&ZoomOutImages;
  586. }
  587.  
  588. # ----BOOKMARK MACROS----
  589.  
  590. BookSync{
  591. setcheck("macros(BookChev)",getpref(BOOL,"kmeleon.plugins.bookmarks.chevron"));
  592. setcheck("macros(FavChev)",getpref(BOOL,"kmeleon.plugins.favorites.chevron"));
  593. setcheck("macros(HotChev)",getpref(BOOL,"kmeleon.plugins.hotlist.chevron"));
  594. setcheck("macros(OpenBook1)",getpref(STRING,$book)=="ID_OPEN_LINK" ? true:false);
  595. setcheck("macros(OpenBook2)",getpref(STRING,$book)=="ID_OPEN_LINK_IN_NEW_WINDOW"? true:false);
  596. setcheck("macros(OpenBook3)",getpref(STRING,$book)=="layers(OpenURL)"? true:false);
  597. setcheck("macros(OpenBook4)",getpref(STRING,$book)=="layers(OpenURLBg)"? true:false);
  598. setcheck("macros(OpenBook5)",getpref(STRING,$book)=="ID_OPEN_LINK_IN_BACKGROUND"? true:false);
  599. setcheck("macros(OpenFav1)",getpref(STRING,$fav)=="ID_OPEN_LINK"? true:false);
  600. setcheck("macros(OpenFav2)",getpref(STRING,$fav)=="ID_OPEN_LINK_IN_NEW_WINDOW"? true:false);
  601. setcheck("macros(OpenFav3)",getpref(STRING,$fav)=="layers(OpenURL)"? true:false);
  602. setcheck("macros(OpenFav4)",getpref(STRING,$fav)=="layers(OpenURLBg)"? true:false);
  603. setcheck("macros(OpenFav5)",getpref(STRING,$fav)=="ID_OPEN_LINK_IN_BACKGROUND"? true:false);
  604. setcheck("macros(OpenHot1)",getpref(STRING,$hot)=="ID_OPEN_LINK"? true:false);
  605. setcheck("macros(OpenHot2)",getpref(STRING,$hot)=="ID_OPEN_LINK_IN_NEW_WINDOW"? true:false);
  606. setcheck("macros(OpenHot3)",getpref(STRING,$hot)=="layers(OpenURL)"? true:false);
  607. setcheck("macros(OpenHot4)",getpref(STRING,$hot)=="layers(OpenURLBg)"? true:false);
  608. setcheck("macros(OpenHot5)",getpref(STRING,$hot)=="ID_OPEN_LINK_IN_BACKGROUND"? true:false);
  609. }
  610.  
  611. FileBook{
  612. plugin(bookmarks,Add); plugin(bookmarks,Edit);
  613. }
  614. FileHot{
  615. plugin(hotlist,Add); plugin(hotlist,Edit);
  616. }
  617. FileFav{
  618. plugin(favorites,Add); plugin(favorites,Edit);
  619. }
  620.  
  621. FavToolbar{
  622. $tf="kmeleon.plugins.favorites.toolbarFolder";
  623. $folder=getpref(STRING,$tf); $folder==""? $folder="Links":""; 
  624. $folder=prompt("Enter the name of the folder to be displayed on your favorites toolbar.","Favorites Toolbar Folder",$folder);
  625. $folder==""?"":setpref(STRING,$tf,$folder);
  626. $folder==""?"":alert("Favorites Toolbar Folder will be  ' " .$folder." '  when K-Ninja is restarted","Favorites Toolbar Folder",INFO);
  627. }
  628. ChangeLinks{
  629. $tit="kmeleon.plugins.favorites.title";
  630. $favtit=getpref(STRING, $tit); $favtit==""? $favtit="Links":""; 
  631. $favtit=prompt("Enter the title to be displayed on your favorites toolbar.", "Toolbar Title     (Leave blank or click Cancel to remove title)", $favtit);
  632. setpref(STRING,$tit,$favtit);
  633. alert("Title change will be apparent when K-Ninja is restarted","Favorites Toolbar Title",INFO);
  634. }
  635.  
  636. Chevron{
  637. $chevron="kmeleon.plugins.".$plugin.".chevron"; togglepref(BOOL,$chevron);
  638. &Sync; getpref(BOOL,$chevron)==true ? $var="- ENABLED":$var="- DISABLED";
  639. alert("\nToolbar Chevron ".$var."\n\n\nChange will be visible when K-Ninja is restarted.","Toolbar Chevron",INFO);
  640. }
  641. BookChev{
  642. $plugin="bookmarks"; &Chevron;
  643. }
  644. FavChev{
  645. $plugin="favorites"; &Chevron;
  646. }
  647. HotChev{
  648. $plugin="hotlist"; &Chevron;
  649. }
  650.  
  651. $ol="ID_OPEN_LINK"; $nw="ID_OPEN_LINK_IN_NEW_WINDOW"; 
  652. $bw="ID_OPEN_LINK_IN_BACKGROUND"; $lo="layers(OpenURL)"; $bl="layers(OpenURLBg)";
  653. $book="kmeleon.plugins.bookmarks.openurl";
  654. $fav="kmeleon.plugins.favorites.openurl";
  655. $hot="kmeleon.plugins.hotlist.openurl";
  656.  
  657. openurl{
  658. setpref(STRING,"kmeleon.plugins.".$plugin.".openurl",$how); &Sync;
  659. }
  660.  
  661. OpenBook1{
  662. $plugin="bookmarks"; $how=$ol; &openurl;
  663. }
  664. OpenBook2{
  665. $plugin="bookmarks"; $how=$nw; &openurl;
  666. }
  667. OpenBook3{
  668. $plugin="bookmarks"; $how=$lo; &openurl;
  669. }
  670. OpenBook4{
  671. $plugin="bookmarks"; $how=$bl; &openurl;
  672. }
  673. OpenBook5{
  674. $plugin="bookmarks"; $how=$bw; &openurl;
  675. }
  676.  
  677. OpenFav1{
  678. $plugin="favorites"; $how=$ol; &openurl;
  679. }
  680. OpenFav2{
  681. $plugin="favorites"; $how=$nw; &openurl;
  682. }
  683. OpenFav3{
  684. $plugin="favorites"; $how=$lo; &openurl;
  685. }
  686. OpenFav4{
  687. $plugin="favorites"; $how=$bl; &openurl;
  688. }
  689. OpenFav5{
  690. $plugin="favorites"; $how=$bw; &openurl;
  691. }
  692.  
  693. OpenHot1{
  694. $plugin="hotlist"; $how=$ol; &openurl;
  695. }
  696. OpenHot2{
  697. $plugin="hotlist"; $how=$nw; &openurl;
  698. }
  699. OpenHot3{
  700. $plugin="hotlist"; $how=$lo; &openurl;
  701. }
  702. OpenHot4{
  703. $plugin="hotlist"; $how=$bl; &openurl;
  704. }
  705. OpenHot5{
  706. $plugin="hotlist"; $how=$bw; &openurl;
  707. }
  708.  
  709. # ----GROUP MACROS----
  710.  
  711. $kg="kmeleon.group."; $URL="";
  712. $rl="ReplaceLayersInWindow";
  713. $al="AddLayersToWindow";
  714. $gl="GetLayersInWindow";
  715. $fn="FindNick"; $lc="";
  716. $gn="kmeleon.groupnames";
  717.  
  718. ReadNames{
  719. $names=getpref(STRING, $gn);
  720. }
  721. Checkname{
  722. $checkname="\n".$name."\n"; $exists=index($names,$checkname);
  723. }
  724.  
  725. SaveAsGroup{
  726. &ReadNames; $names==""? $names="\n":0;
  727. $group=pluginmsgex(layers,$gl,"",STRING);
  728. $name=prompt(_("Enter a Group Name to save these layers as:"),_("Group Name?"),"");
  729. $name==""?"": &Checkname;
  730. $name==""?"": $exists!=-1? &ConfirmGroup:&SaveGroup;
  731. }
  732. ConfirmGroup{
  733. confirm(_("Group Name exists. Overwrite?"),sub("%s", $name, _("Group Name '%s' Found")),YESNO,EXCLAIM)=="YES"? setpref(STRING, $kg.$name,$group):&SaveAsGroup;
  734. }
  735. SaveGroup{
  736. setpref(STRING,$gn,$names.$name."\n"); setpref(STRING,$kg.$name,$group);
  737. confirm(sub("%s", $name, "\n"._("Type '%s' in the URL Bar and press SHIFT+ENTER to open it only or ALT+ENTER to open it next to the current layers.")."\n\n"._("Open this Group everytime you start K-Ninja?")),sub("%s", $name, _("Group Saved As:  %s")),YESNO)=="NO" ?"":&SetGroup;
  738. }
  739.  
  740. SavedGroups{
  741. &ReadNames; $names==""? $var=_("Folder"): $var=_("Group");
  742. $names==""? $names=_("No Group Names Found") ."\n":0;
  743. $open=confirm($names."\n\n".sub("%s", $var, _("Open a %s now?")), _("Saved Groups"))=="OK"? &OpenGroup:"";
  744. }
  745.  
  746. URLToGroup{
  747. $name=prompt(_("Enter a Group Name to add this URL to:"),_("Group Name?"),"");
  748. getpref(STRING,$kg.$name); $group=getpref(STRING,$kg.$name);
  749. $name==""?"":$group==""? &NoGroup:&AddURL;
  750. }
  751. AddURL{
  752. setpref(STRING,$kg.$name,$group.$URL."\t");
  753. $prompt_text=sub("%s",$name,sub("%s", $TITLE, The URL for  '%s'  has been added to Group: %s));
  754. alert($prompt_text,sub("%s", $name, "Group:  '%s'  Updated"),INFO);
  755. }
  756.  
  757. NoGroup{
  758. alert("No Group Found");
  759. }
  760.  
  761. LayersToGroup {
  762. $name=prompt(_("Enter a Group Name to add these layers to"),_("Group Name?"),"");
  763. getpref(STRING,$kg.$name); $group=getpref(STRING,$kg.$name);
  764. $name==""?"": $group==""? &NoGroup:&AddLayers;
  765. }
  766.  
  767. AddLayers{
  768. $curr=pluginmsgex(layers,"GetLayersInWindow","",STRING);
  769. setpref(STRING,$kg.$name,$group.$curr);
  770.  
  771. $prompt_text = sub("%s", $var, _("Layers added to Group: %s"));
  772. $prompt_title = sub("%s", $var, _("Group:  '%s'  Updated"));
  773.  
  774. alert($prompt_text,$prompt_title,INFO);
  775. }
  776.  
  777. DeleteGroup{
  778. &ReadNames; $names==""? &NoGroup:&ConfirmDelete;
  779. }
  780.  
  781. ConfirmDelete{
  782. $open=confirm($names."\n\n"._("Do you want to delete one of these groups?"),_("Saved Groups"),YESNO);
  783. $open=="NO"? "":&PromptDelete;
  784. }
  785. PromptDelete{
  786. $name=prompt(_("Enter Name of Group to Delete:"),_("Group Name?"),"");
  787. $name==""?"": &Checkname;
  788. $name==""?"": $exists!=-1? &DeleteURLs:&NoGroup;
  789. }
  790. DeleteURLs{
  791. $names=sub($checkname,"\n",$names);
  792. setpref(STRING,$gn,$names); delpref($kg.$name);
  793.  
  794. $prompt_text = sub("%s", $var, _("Group: '%s' deleted."));
  795. alert($prompt_text ,_("Group Deleted"),INFO);
  796. }
  797.  
  798. PluginCheck{
  799. $hot=getpref(BOOL,"kmeleon.plugins.bookmarks.load")
  800. $hot==false ? $hot=getpref(BOOL,"kmeleon.plugins.hotlist.load"): "";
  801. $hot==false ? $tip=_("Enter Group Name"):$tip=_("Enter Group Name or Folder Nick");
  802. }
  803.  
  804. SetOnly{
  805. setpref(STRING,$og,"layers(ReplaceLayersInWindow)");
  806. }
  807. SetNext{
  808. setpref(STRING,$og,"layers(AddLayersToWindow)");
  809. }
  810. GroupOnly{
  811. $lc=$rl; &SetOnly; &OpenGroup; $lc=$al; &SetNext;
  812. }
  813. OpenGroup{
  814. $name=$URLBAR;$name==""?$name=$URL:"";
  815. $name==$URL? &PromptGroup:&ChkGroup; 
  816. }
  817. PromptGroup{
  818. &PluginCheck; $name=prompt($tip,_("Group Name?"),"");
  819. $name==""?"":&ChkGroup;
  820. }
  821. ChkGroup{
  822. $group=getpref(STRING,$kg.$name); $group==""? &ChkFolder:&Group;
  823. }
  824. ChkFolder{
  825. $plugin="bookmarks"; $group=pluginmsgex($plugin,$fn,$name,STRING)==""? $plugin="hotlist":"";
  826. pluginmsgex($plugin,$fn,$name,STRING)==""? &ResetURL:&Folder;
  827. }
  828. Group{
  829. $lc==""? $lc=$al:""; pluginmsg(layers,$lc,$group);
  830. }
  831. Folder{
  832. $URLBAR=$name; id(ID_NAV_GO); &ResetURL;
  833. }
  834.  
  835. # STARTUP GROUP & LAST SESSION MACROS
  836.  
  837. $loaded="";
  838. $sg="kmeleon.general.startGroup";
  839. $sn="kmeleon.general.startGroupName";
  840. $sh="kmeleon.general.startHome";
  841. $og="kmeleon.general.opengroup";
  842. $gt="kmeleon.grouptemp";
  843. $kl="kmeleon.grouplast";
  844. $ln="ID_OPEN_LINK_IN_NEW_WINDOW|ID_OPEN_LINK_IN_BACKGROUND";
  845.  
  846. GroupsSync{
  847. getpref(BOOL,$sh)==true ? setpref(INT,$sg,0):"";
  848. setcheck("macros(StartHome)",getpref(BOOL,$sh));
  849. setcheck("macros(StartBlank)",getpref(INT,$sg)==1? true:false);
  850. setcheck("macros(StartGroup)",getpref(INT,$sg)==2? true:false);
  851. setcheck("macros(StartLast)",getpref(INT,$sg)==3? true:false);
  852. }
  853.  
  854.  
  855. StartGroup{
  856. $oldname=getpref(STRING,$sn); &PluginCheck;
  857. $name=prompt($tip,_("Startup Group Name?"),$oldname);
  858. $name==""?"":$group=getpref(STRING,$kg.$name)==""? &FolderCheck:&SetGroup;
  859. }
  860. FolderCheck{
  861. $plugin="bookmarks"; $group=pluginmsgex($plugin,$fn,$name,STRING)==""? $plugin="hotlist":0;
  862. $group=pluginmsgex($plugin,$fn,$name,STRING)==""? &NoStart:&SetGroup;
  863. }
  864. SetGroup{
  865. setpref(INT,$sg,2); setpref(STRING,$sn,$name); setpref(BOOL,$sh,false); &Sync;
  866. }
  867. NoStart{
  868. &NoGroup; setpref(STRING,$sn,$oldname); &StartGroup;
  869. }
  870. StartLast{
  871. setpref(INT,$sg,3); setpref(BOOL, $sh, false); &Sync;
  872. }
  873. StartHome{
  874. setpref(INT,$sg,0); setpref(BOOL,$sh,true); &Sync;
  875. }
  876. StartBlank{
  877. setpref(INT,$sg,1); setpref(BOOL,$sh,false); &Sync;
  878. }
  879.  
  880. GroupStart{
  881. $name=getpref(STRING,$sn);$theurl=$URLBAR;
  882. $theurl=="about:blank"? &LayersCheck:"";
  883. $loaded="";
  884. }
  885. LayersCheck{
  886. $layer=="true"? &StartLayers:&StartWindows;
  887. }
  888. StartLayers{
  889. $lc=$rl; &SetOnly; getpref(INT,$sg)==3 ? &OpenLast:&OpenStart;
  890. $lc=$al; &SetNext;
  891. }
  892. OpenLast{
  893. $group=getpref(STRING,$kl); $group==""?"":&Group;
  894. }
  895. OpenStart{
  896. $name=getpref(STRING,$sn); &ChkGroup;
  897. }
  898. StartWindows{
  899. setpref(STRING,$og,"ID_OPEN_LINK|ID_OPEN_LINK_IN_BACKGROUND");
  900. $name=getpref(STRING,$sn); getpref(INT,$sg)==3 ?"":&ChkFolder;
  901. setpref(STRING,$og,$ln);
  902. }
  903.  
  904. GetSetTemp{
  905. $group=pluginmsgex(layers,$gl,"",STRING); setpref(STRING,$gt,$group);
  906. }
  907. SetLast{
  908. $group=getpref(STRING, $gt); setpref(STRING,$kl,$group);
  909. }
  910. OpenClosed{
  911. $lc=$rl; $group=getpref(STRING,$gt); $curr=pluginmsgex(layers,$gl,"",STRING);
  912. $group==$curr?"":$curr=""; $curr==""? &Group:"";
  913. }
  914.  
  915. ReloadAll{
  916. pluginmsg(layers,"AllLayersInWindow","ID_NAV_RELOAD");
  917. }
  918.  
  919. Home{
  920. getpref(INT,$sg)!=2 ? id(ID_NAV_HOME):&OpenStart;
  921. }
  922.  
  923.  
  924. # ----MAIL MACROS----
  925.  
  926. $mc=$macroPrefBranch."mailClient";
  927. $nc=$macroPrefBranch."newsClient";
  928.  
  929. defMail{
  930. $base="Software\\Clients\\Mail\\";
  931. $base=$base.readreg("HKLM",$base);
  932. $def=readreg("HKLM",$base."\\shell\\open\\command\\");
  933. $sys=readreg("HKLM",$base."\\protocols\\mailto\\shell\\open\\command\\");
  934. $usr=readreg("HKCR","mailto\\shell\\open\\command\\");
  935. $usr==$sys?$client=$def:$client=$usr;
  936. }
  937. defNews{
  938. $base="Software\\Clients\\News\\";
  939. $base=$base.readreg("HKLM",$base);
  940. $def=readreg("HKLM",$base."\\shell\\open\\command\\");
  941. $sys=readreg("HKLM",$base."\\protocols\\news\\shell\\open\\command\\");
  942. $usr=readreg("HKCR","news\\shell\\open\\command\\");
  943. $usr==$sys?$client=$def:$client=$usr;
  944. }
  945. MNgetPref{
  946. $client=getpref(STRING,$mnPref);
  947. }
  948. MNsetPref{
  949. setpref(STRING,$mnPref,$client);
  950. }
  951. MNcfg{
  952. &MNgetPref; $client==""?macros($macro):""; $client=prompt($txt,$tit,$client); $client==""?"":&MNsetPref;
  953. }
  954. MNopen{
  955. &MNgetPref;
  956. # Client not set? Configure!
  957. $client==""?macros($macro):"";
  958. # Client (now) set? Open!
  959. $client==""?"":(index($client,"://")==-1?exec($client):opennew($client));
  960. }
  961.  
  962. Mail{
  963. $mnPref=$mc; $macro="MCFG"; &MNopen;
  964. }
  965. News{
  966. $mnPref=$nc; $macro="NCFG"; &MNopen;
  967. }
  968.  
  969. MCFG{
  970. $mnPref=$mc; $macro="defMail"; $txt=_("Enter your mail client's path or your web mailer's URL:"); $tit=_("Configure Mail"); &MNcfg;
  971. }
  972. NCFG{
  973. $mnPref=$nc; $macro="defNews"; $txt=_("Enter your news client's path or your newsgroups provider's URL:"); $tit=_("Configure Newsgroups"); &MNcfg;
  974. }
  975.  
  976. Compose{
  977. open("mailto:");
  978. }
  979.  
  980. EmailURL{
  981. $JSdoit="with(top.document)location='mailto:?subject='+encodeURIComponent(title)+'&body='+encodeURIComponent(URL)"; &hndlDoc;
  982. }
  983. EmailImageURL{
  984. $JSdoitImg="location='mailto:?subject='+encodeURIComponent((title)?title:((alt)?alt:document.title))+'&body='+encodeURIComponent(src)"; &hndlImg;
  985. }
  986. EmailFrameURL{
  987. $JSdoit="location='mailto:?subject='+encodeURIComponent(title)+'&body='+encodeURIComponent(URL)"; &hndlDoc;
  988. }
  989. EmailText{
  990. $JSdoit="if(getSelection())location='mailto:?subject='+encodeURIComponent(title)+'&body='+encodeURIComponent(getSelection())"; &hndlDoc;
  991. }
  992.  
  993.  
  994. # ----PRIVACY MACROS----
  995.  
  996. $animation="image.animation_mode";
  997. $colors="browser.display.use_document_colors";
  998. $cookies="network.cookie.cookieBehavior";
  999. $images="permissions.default.image";
  1000. $java="security.enable_java";
  1001. $jscript="javascript.enabled";
  1002. $popups="dom.disable_open_during_load";
  1003. $referer="network.http.sendRefererHeader";
  1004.  
  1005. PrivacySync{
  1006. setcheck("macros(BlockScripts)",getpref(BOOL,$flip));
  1007. setcheck("macros(AllowScripts)",getpref(BOOL,$flip)==false ? true:false);
  1008.  
  1009. setcheck("macros(AniToggle)",getpref(STRING,$animation)=="none"? true:false);
  1010. pluginmsg(toolbars,"CheckButton","Privacy Bar,macros(AniToggle),".(getpref(STRING,$animation)=="none"? 1:0));
  1011.  
  1012. setcheck("macros(CToggle)",getpref(BOOL,$colors)? false:true);
  1013. pluginmsg(toolbars,"CheckButton","Privacy Bar,macros(CToggle),".(getpref(BOOL,$colors)? 0:1));
  1014.  
  1015. setcheck("macros(CKToggle)", getpref(INT,$cookies)? false:true);
  1016. pluginmsg(toolbars,"CheckButton","Privacy Bar,macros(CKToggle),".(getpref(INT,$cookies)==2? 1:0));
  1017.  
  1018. setcheck("macros(ImgToggle)",getpref(INT,$images)==1? false:true);
  1019. pluginmsg(toolbars,"CheckButton","Privacy Bar,macros(ImgToggle),".(getpref(INT,$images)==1? 0:1));
  1020.  
  1021. setcheck("macros(JToggle)", getpref(BOOL,$java)? false:true);
  1022. pluginmsg(toolbars,"CheckButton","Privacy Bar,macros(JToggle),".(getpref(BOOL,$java)? 0:1));
  1023.  
  1024. setcheck("macros(JSToggle)",getpref(BOOL,$jscript)? false:true);
  1025. pluginmsg(toolbars, "CheckButton", "Javascript button, macros(JSToggle), " . (getpref(BOOL, $jscript) ? 0 : 1));
  1026. pluginmsg(toolbars,"CheckButton","Privacy Bar,macros(JSToggle),".(getpref(BOOL,$jscript)? 0:1));
  1027.  
  1028. setcheck("macros(PBToggle)",getpref(BOOL,$popups));
  1029. pluginmsg(toolbars,"CheckButton","Main Bar,macros(PBToggle),".(getpref(BOOL,$popups)? 1:0));
  1030. pluginmsg(toolbars,"CheckButton","Privacy Bar,macros(PBToggle),".(getpref(BOOL,$popups)? 1:0));
  1031.  
  1032. setcheck("macros(RefToggle)",getpref(INT,$referer)==1? false:true);
  1033. pluginmsg(toolbars,"CheckButton","Privacy Bar,macros(RefToggle),".(getpref(INT,$referer)? 0:1));
  1034. }
  1035.  
  1036. AniToggle {
  1037. togglepref(STRING,$animation,"normal","none"); &Sync;
  1038. getpref(STRING,$animation)=="none"?$tip=_("BLOCKED"):$tip=_("ALLOWED");
  1039. statusbar(_("Animation ").$tip);
  1040. }
  1041.  
  1042. CToggle{
  1043. togglepref(BOOL,$colors); &PrivacySync;
  1044. getpref(BOOL,$colors)==false ? $tip=_("BLOCKED"):$tip=_("ALLOWED");
  1045. statusbar(_("Page Colors ").$tip);
  1046. }
  1047.  
  1048. CKToggle {
  1049. togglepref(INT,$cookies,2,0); &PrivacySync;
  1050. getpref(INT,$cookies)==2 ? $tip=_("BLOCKED"):$tip=_("ALLOWED");
  1051. statusbar(_("Cookies ").$tip);
  1052. }
  1053.  
  1054. PBToggle{
  1055. togglepref(BOOL,$popups); &PrivacySync;
  1056. getpref(BOOL,$popups)==true ? $tip=_("BLOCKED"):$tip=_("ALLOWED");
  1057. statusbar(_("Popups ").$tip);
  1058. }
  1059.  
  1060. JToggle{
  1061. togglepref(BOOL,$java); &PrivacySync;
  1062. getpref(BOOL,$java)==false ? $tip=_("BLOCKED"):$tip=_("ALLOWED");
  1063. statusbar(_("Java ").$tip);
  1064. }
  1065.  
  1066. JSToggle{
  1067. togglepref(BOOL,$jscript); &PrivacySync;
  1068. getpref(BOOL,$jscript)==false ? $tip=_("BLOCKED"):$tip=_("ALLOWED");
  1069. statusbar(_("JavaScript ").$tip);
  1070. }
  1071.  
  1072. ImgToggle {
  1073. togglepref(INT,$images,1,2); &PrivacySync;
  1074. getpref(INT,$images)==2 ? $tip=_("BLOCKED"):$tip=_("ALLOWED");
  1075. statusbar(_("Images ").$tip);
  1076. }
  1077.  
  1078. RefToggle {
  1079. togglepref(INT,$referer,1,2); &PrivacySync;
  1080. getpref(INT,$referer)==1 ? $tip=_("ALLOWED"):$tip=_("BLOCKED");
  1081. statusbar(_("Referer ").$tip);
  1082. }
  1083.  
  1084. $ua="general.useragent.override"; $uas="";
  1085. $pu="kmeleon.privacy.useragent"; $ps=".string";
  1086. $uar="kmeleon.privacyUA.noReset";
  1087.  
  1088. $ua="general.useragent.override"; $uas="";
  1089. $pu="kmeleon.privacy.useragent"; $ps=".string";
  1090. $uar="kmeleon.privacyUA.noReset";
  1091.  
  1092. # ---- User Agent ----
  1093. UASync{
  1094. setcheck("macros(UA)",""==getpref(STRING,$ua)? true:false);
  1095. setcheck("macros(UA1)",getpref(STRING,$pu."1".$ps)==getpref(STRING,$ua)? true:false);
  1096. setcheck("macros(UA2)",getpref(STRING,$pu."2".$ps)==getpref(STRING,$ua)? true:false);
  1097. setcheck("macros(UA3)",getpref(STRING,$pu."3".$ps)==getpref(STRING,$ua)? true:false);
  1098. setcheck("macros(ResetUA)",getpref(BOOL,$uar)?false:true);
  1099. }
  1100.  
  1101. UA{
  1102. delpref($ua); &Sync;
  1103. }
  1104. UA1{
  1105. $uas=getpref(STRING,$pu."1".$ps); &SetUA;
  1106. }
  1107. UA2{
  1108. $uas=getpref(STRING,$pu."2".$ps); &SetUA;
  1109. }
  1110. UA3{
  1111. $uas=getpref(STRING,$pu."3".$ps); &SetUA;
  1112. }
  1113. UACust{
  1114. $uas=getpref(STRING,$ua);
  1115. $uas=prompt(_("Enter the User Agent string to identify K-Ninja as:"),_("Custom User Agent"),$uas);
  1116. $uas==""?"":&SetUA;
  1117. }
  1118. SetUA{
  1119. setpref(STRING,$ua,$uas); &UASync;
  1120. }
  1121. ResetUA{
  1122. togglepref(BOOL,$uar); &UASync;
  1123. }
  1124.  
  1125. ClearAll{
  1126. plugin(privacy,ClearCache); plugin(privacy,ClearCookies);
  1127. plugin(privacy,ClearHistory); plugin(privacy,ClearMRU);
  1128. plugin(privacy,ClearSignon);
  1129. }
  1130.  
  1131. KillFlash{
  1132. $JSdoit="del(w.document,'object');del(w.document,'embed')"; &Kill;
  1133. }
  1134.  
  1135. KillApplets{
  1136. $JSdoit="del(w.document,'applet')"; &Kill;
  1137. }
  1138.  
  1139. Kill{
  1140. $JSfunc="function del(doc,tag){for(var d,e=doc.getElementsByTagName(tag),j=e.length-1;j+1;j--){d=doc.createElement('div');d.innerHTML='<del>'+tag+'</del>';d.style.height=e[j].height;d.style.width=e[j].width;e[j].parentNode.replaceChild(d,e[j])}}";
  1141. &hndlDocs;
  1142. }
  1143.  
  1144. # ----LAYER MACROS----
  1145.  
  1146. LayerSync{
  1147. setcheck("macros(Enumerate)",getpref(BOOL,$num));
  1148. setcheck("macros(Pressed)",getpref(INT,$style)==2? true:false);
  1149. setcheck("macros(Pressed+)",getpref(INT,$style)==10? true:false);
  1150. setcheck("macros(Buttons)",getpref(INT,$style)==6? true:false);
  1151. setcheck("macros(Buttons+)",getpref(INT,$style)==14? true:false);
  1152. setcheck("macros(SetCloseLast)",getpref(INT,$onClose)==0? true:false);
  1153. setcheck("macros(SetCloseLeft)",getpref(INT,$onClose)==1? true:false);
  1154. setcheck("macros(SetCloseRight)",getpref(INT,$onClose)==2? true:false);
  1155. setcheck("macros(SetOpenNext)",getpref(INT,$onOpen)==1? true:false);
  1156. setcheck("macros(SetOpenLast)",getpref(INT,$onOpen)==0? true:false);
  1157. setcheck("macros(ConfirmToggle)",getpref(BOOL,$confirm));
  1158. }
  1159.  
  1160. LayersSync{
  1161. getpref(BOOL,$layers)==false ? setpref(BOOL,$catch,false):"";
  1162. getpref(BOOL,$layers)==false ? setpref(STRING,$mode,"WINDOWS ONLY"):(getpref(BOOL,$catch)==true ? setpref(STRING,$mode,"LAYERS ONLY"):setpref(STRING,$mode,""));
  1163. setcheck("macros(LayersOnly)",getpref(BOOL,$catch)==true ? true:false);
  1164. setcheck("macros(LayersWindows)",getpref(STRING,$mode)==""? true:false);
  1165. setcheck("macros(WindowsOnly)",$layer==false ? true:false);
  1166. setcheck("macros(URLInCurr)",getpref(STRING,$ou)=="ID_OPEN_LINK"? true:false);
  1167. setcheck("macros(URLInNew)", getpref(STRING,$ou)=="ID_OPEN_LINK_IN_NEW_WINDOW"? true:false);
  1168. setcheck("macros(URLInLayer)",getpref(STRING,$ou)=="layers(OpenURL)"? true:false);
  1169. setcheck("macros(URLInBg)",getpref(STRING,$ou)=="ID_OPEN_LINK_IN_BACKGROUND"? true:false);
  1170. setcheck("macros(URLInBgLayer)",getpref(STRING,$ou)=="layers(OpenURLBg)"? true:false);
  1171. }
  1172.  
  1173. $catch="kmeleon.plugins.layers.catchOpen";
  1174. $mode="kmeleon.general.mode";
  1175. $flip="dom.disable_window_flip";
  1176.  
  1177. LayersOnly{
  1178. $var="LAYERS ONLY"; setpref(BOOL,$layers,true); setpref(BOOL,$catch,true);
  1179. $bool=true; $menu=false; &Scripts; setpref(STRING,$mode,$var); &Sync; 
  1180. alert("All new windows will open in layers. If switching from Windows Only mode, you'll need to restart K-Ninja for Layers  Only mode to take effect.","Browsing Mode:  ".$var,INFO);
  1181. }
  1182.  
  1183. LayersWindows{
  1184. $var=""; setpref(BOOL,$layers,true);
  1185. setpref(BOOL,$catch,false); setpref(STRING,$mode,$var); &Sync; 
  1186. alert("You will now be able to browse using layers and multiple windows. If switching from Windows Only mode, you'll need to  restart K-Ninja for Layers and Windows mode to take effect.","Browsing Mode:  Layers & Windows", INFO);
  1187. }
  1188.  
  1189. WindowsOnly{
  1190. $var="WINDOWS ONLY"; $quest=confirm("\nWindows Only mode will disable the layers plugin. Groups and Sessions will not be  available, only Folder Groups for Bookmarks & Hotlist plugin users.\n\n\nDo you want to disable the layers plugin?","Browsing Mode:  ".$var,YESNO,EXCLAIM);
  1191. $quest=="NO"?"":&SetWO; 
  1192. }
  1193. SetWO{
  1194. setpref(BOOL,$layers,false); setpref(BOOL,$catch,false); setpref(STRING,$mode,$var); &Sync; 
  1195. alert("Restart K-Ninja for Windows Only mode to take effect.","Browsing Mode:  ".$var,INFO);
  1196. }
  1197.  
  1198. BlockScripts{
  1199. $bool=true; $menu=false; &Scripts; &Sync; 
  1200. alert("Sites are now BLOCKED from hiding toolbars, resizing the browser and disabling context menus.",Scripts,INFO);
  1201. }
  1202. AllowScripts{
  1203. $bool=false; $menu=true; &Scripts; &Sync;
  1204. alert("Sites are now ALLOWED to hide toolbars, resize the browser and disable context menus.",Scripts, INFO);
  1205. }
  1206. Scripts{
  1207. setpref(BOOL,$flip,$bool); 
  1208. setpref(BOOL,"dom.disable_window_move_resize",$bool);
  1209. setpref(BOOL,"dom.disable_window_open_feature.*",$bool); 
  1210. setpref(BOOL,"dom.disable_window_open_feature.minimizable",$bool);
  1211. setpref(BOOL,"dom.disable_window_open_feature.titlebar",$bool); 
  1212. setpref(BOOL,"dom.disable_window_open_feature.close",$bool);
  1213. setpref(BOOL,"dom.disable_window_open_feature.toolbar",$bool); 
  1214. setpref(BOOL,"dom.disable_window_open_feature.location",$bool);
  1215. setpref(BOOL,"dom.disable_window_open_feature.directories",$bool); 
  1216. setpref(BOOL,"dom.disable_window_open_feature.personalbar",$bool);
  1217. setpref(BOOL,"dom.disable_window_open_feature.menubar",$bool);
  1218. setpref(BOOL,"dom.disable_window_open_feature.scrollbars",$bool);
  1219. setpref(BOOL,"dom.disable_window_open_feature.resizable",$bool);
  1220. setpref(BOOL,"dom.disable_window_open_feature.status",$bool);
  1221. setpref(BOOL,"dom.disable_window_status_change",$bool);
  1222. setpref(BOOL,"dom.event.contextmenu.enabled",$menu);
  1223. }
  1224.  
  1225. $num="kmeleon.plugins.layers.numbers";
  1226. $style="kmeleon.plugins.layers.style";
  1227.  
  1228. LayerAlert{
  1229. alert("Some changes will only be fully apparent when the next layer is opened.","Layer Appearance Change Completed",INFO);
  1230. }
  1231. Enumerate{
  1232. togglepref(BOOL,$num); &Sync; &LayerAlert;
  1233. }
  1234. Style{
  1235. setpref(INT,$style,$int); &Sync; &LayerAlert;
  1236. }
  1237. Pressed{
  1238. $int=2; &Style;
  1239. }
  1240. Pressed+{
  1241. $int=10; &Style;
  1242. }
  1243. Buttons{
  1244. $int=6; &Style;
  1245. }
  1246. Buttons+{
  1247. $int=14; &Style;
  1248. }
  1249.  
  1250. LayersTitle{
  1251. $lt="kmeleon.plugins.layers.title";
  1252. $var=getpref(STRING, $lt); $var==""?$var="Layers:":"";
  1253. $var=prompt("Enter layer bar title:","Layer Bar Title     ( To remove title, leave blank or Cancel )",$var);
  1254. setpref(STRING,$lt,$var);
  1255. alert("Layer bar title = ".$var."\n\nChange will be visible when K-Ninja is restarted.","Layer Bar Title",INFO);
  1256. }
  1257.  
  1258. LayerWidth{
  1259. $max="kmeleon.plugins.layers.maxWidth";
  1260. $min="kmeleon.plugins.layers.minWidth";
  1261. $maxwid=getpref(INT,$max); $minwid=getpref(INT,$min);
  1262. $maxwid==0 ? $maxwid=35:"";
  1263. $maxwid=prompt("Enter Maximum Width:",Maximum Width,$maxwid);
  1264. $maxwid==""?"":setpref(INT,$max,$maxwid);
  1265. $maxwid==""?"":$minwid=prompt("Enter Minimum Width:",Minimum Width,$minwid);
  1266. $maxwid==""?"":$minwid==""?"":setpref(INT,$min,$minwid);
  1267. $maxwid==""?"":$minwid==""?"":alert("Maximum = ".$maxwid."\nMinimum = ".$minwid,"Layer Bar Button Width",INFO);
  1268. }
  1269.  
  1270. $onClose="kmeleon.plugins.layers.onCloseOption";
  1271. $onOpen="kmeleon.plugins.layers.onOpenOption";
  1272.  
  1273. SetCloseRight{
  1274. setpref(INT,$onClose,2); &Sync;
  1275. }
  1276. SetCloseLeft{
  1277. setpref(INT,$onClose,1); &Sync;
  1278. }
  1279. SetCloseLast{
  1280. setpref(INT,$onClose,0); &Sync;
  1281. }
  1282. SetOpenNext{
  1283. setpref(INT,$onOpen,1); &Sync;
  1284. }
  1285. SetOpenLast{
  1286. setpref(INT,$onOpen,0); &Sync;
  1287. }
  1288.  
  1289. $confirm="kmeleon.plugins.layers.confirmClose";
  1290.  
  1291. ConfirmToggle{
  1292. togglepref(BOOL,$confirm); &Sync;
  1293. getpref(BOOL,$confirm)==false ? $tip="DISABLED":$tip="ENABLED";
  1294. statusbar("Confirm before close ".$tip);
  1295. }
  1296.  
  1297. Selected{
  1298. $old=getclipboard(); setclipboard(); id(ID_EDIT_COPY); $add=getclipboard();
  1299. }
  1300.  
  1301. New{
  1302. $add=$SelectedText; $URLBAR=$URL;
  1303. $add==""? &Open:(getpref(STRING,$ou)!="ID_OPEN_LINK"? &PasteSel:&OpenNew);
  1304. }
  1305. Open{
  1306. $layer==true ? plugin(layers,Open):id(ID_NEW_BROWSER); 
  1307. }
  1308. OpenNew{
  1309. &ResetURL; 
  1310. $layer==true ? pluginmsg(layers,OpenURL,"about:blank"):opennew("about:blank");
  1311. $loaded="go";$go_url = $add;
  1312. }
  1313.  
  1314. PasteSel{
  1315. $add==""?id(ID_NAV_GO): $URLBAR=$add;id(ID_NAV_GO);
  1316. }
  1317.  
  1318. go{
  1319. $URLBAR=$go_url;id(ID_NAV_GO);$loaded="";
  1320. }
  1321.  
  1322.  
  1323. # ----URL BAR MACROS----
  1324.  
  1325. SelectGo{
  1326. $selection=$SelectedText;
  1327. $selection==""?"":$URLBAR=$selection;
  1328. id(ID_NAV_GO);
  1329. }
  1330.  
  1331. Copy{
  1332. id(ID_SELECT_URL); id(ID_EDIT_COPY);
  1333. }
  1334.  
  1335. PasteGo{
  1336. $URLBAR=getclipboard();id(ID_NAV_GO);
  1337. }
  1338.  
  1339. $ou="kmeleon.general.openurl";
  1340.  
  1341. URLBar{
  1342. setpref(STRING,$ou,$var); &Sync
  1343. }
  1344. URLInCurr{
  1345. $var="ID_OPEN_LINK"; &URLBar;
  1346. }
  1347. URLInLayer{
  1348. $var="layers(OpenURL)"; &URLBar;
  1349. }
  1350. URLInNew{
  1351. $var="ID_OPEN_LINK_IN_NEW_WINDOW"; &URLBar;
  1352. }
  1353. URLInBgLayer{
  1354. $var="layers(OpenURLBg)"; &URLBar;
  1355. }
  1356. URLInBg{
  1357. $var="ID_OPEN_LINK_IN_BACKGROUND"; &URLBar;
  1358. }
  1359.  
  1360. OpenInNew{
  1361. $old=getpref(STRING,$ou); $layer==true? &URLInLayer:&URLInNew;
  1362. id(ID_NAV_GO); setpref(STRING,$ou,$old);
  1363. }
  1364.  
  1365. up_directory {
  1366. $var=dirname($URL); $var=="."?"":open($var."/");
  1367. }
  1368.  
  1369. top_level {
  1370. InjectJS("location.pathname = \"\"");
  1371. }
  1372.  
  1373. top{
  1374. open("javascript:location.pathname = ""; void 0");
  1375. }
  1376.  
  1377. $dom="kmeleon.general.domComplete"; 
  1378.  
  1379. ctrl_enter{
  1380. $var="0"; &GetComplete; &Domain;
  1381. }
  1382. ctrl_alt_enter{
  1383. $var="1"; &GetComplete; &Domain;
  1384. }
  1385. ctrl_shift_enter{
  1386. $var="2"; &GetComplete; &Domain;
  1387. }
  1388.  
  1389. GetComplete{
  1390. $prefix=getpref(STRING,$dom.$var.".prefix");  
  1391. $prefix==""? $prefix="http://www.":"";
  1392. $suffix=getpref(STRING,$dom.$var.".suffix");
  1393. $var=="0"?($suffix==""?$suffix=".com":"";):"";
  1394. $var=="1"?($suffix==""?$suffix=".net":"";):""; 
  1395. $var=="2"?($suffix==""?$suffix=".org":"";):"";
  1396. }
  1397.  
  1398. Domain{
  1399. $old=getclipboard(); setclipboard(); id(ID_SELECT_URL); id(ID_EDIT_COPY);
  1400. $theurl=getclipboard(); $theurl==""? &ResetURL: &Complete; setclipboard($old);
  1401. }
  1402. Complete{
  1403. $fullurl=$prefix.$theurl.$suffix;
  1404. setclipboard($fullurl); id(ID_EDIT_PASTE); id(ID_NAV_GO); 
  1405. }
  1406.  
  1407. CEConfig{
  1408. $var="0"; &GetComplete; $tip="Ctrl + Enter"; &DomConfig;
  1409. }
  1410. CAEConfig{
  1411. $var="1"; &GetComplete; $tip="Ctrl + Alt + Enter"; &DomConfig;
  1412. }
  1413. CSEConfig{
  1414. $var="2"; &GetComplete; $tip="Ctrl + Shift + Enter"; &DomConfig;
  1415. }
  1416.  
  1417. DomConfig{
  1418. $prefix=prompt("Prefix:",$tip,$prefix);
  1419. $prefix==""?"":setpref(STRING,$dom.$var.".prefix", $prefix);
  1420. $prefix==""?"":$suffix=prompt("Suffix:",$tip,$suffix);
  1421. $prefix==""?"":$suffix==""?"":setpref(STRING,$dom.$var.".suffix", $suffix);
  1422. $prefix==""?"":$suffix==""?"":alert($prefix."  +  ".$suffix,$tip,INFO);
  1423. }
  1424.  
  1425. $dc=$macroPrefBranch."domComplete";
  1426.  
  1427. domComplete0{
  1428. $n="0"; &DCgo;
  1429. }
  1430. domComplete1{
  1431. $n="1"; &DCgo;
  1432. }
  1433. domComplete2{
  1434. $n="2"; &DCgo;
  1435. }
  1436.  
  1437. DCgetPref{
  1438. $prefix=getpref(STRING,$dc.$n.".prefix");
  1439. $suffix=getpref(STRING,$dc.$n.".suffix");
  1440. }
  1441.  
  1442. DCgo{
  1443. &DCgetPref; $theurl=$URLBAR;
  1444. $theurl==""?"":$theurl=$prefix.$theurl.$suffix;
  1445. $theurl==""?"":$URLBAR=$theurl;
  1446. $theurl==""?"":id(ID_NAV_GO);
  1447. }
  1448.  
  1449. domComplete0cfg{
  1450. $n="0"; $accel=_("Ctrl+Enter"); &DCset;
  1451. }
  1452. domComplete1cfg{
  1453. $n="1"; $accel=_("Ctrl+Alt+Enter"); &DCset;
  1454. }
  1455. domComplete2cfg{
  1456. $n="2"; $accel=_("Ctrl+Shift+Enter"); &DCset;
  1457. }
  1458.  
  1459. DCset{
  1460. $prompt_prefix = sub("%s", $accel, _("On %s add prefix:"));
  1461. $prompt_suffix = sub("%s", $accel, _("On %s add suffix:"));
  1462. $prompt_open = sub("%s", $accel, _("%s will open:"));
  1463.  
  1464. &DCgetPref; $tit=_("Domain Completion");
  1465. $prefix=prompt($prompt_prefix,$tit,$prefix);
  1466. $prefix==""?"":$suffix=prompt($prompt_suffix ,$tit,$suffix);
  1467. $prefix==""?"":$suffix==""?"":&DCsetPref;
  1468. }
  1469.  
  1470. DCsetPref{
  1471. setpref(STRING,$dc.$n.".prefix",$prefix);
  1472. setpref(STRING,$dc.$n.".suffix",$suffix);
  1473. alert($prompt_open."\n\n".$prefix._("<URLBarText>").$suffix,$tit,INFO);
  1474. }
  1475.  
  1476. $path=getpref(STRING,"kmeleon.general.profileDir");
  1477.  
  1478. # ----DOWNLOAD MACROS----
  1479.  
  1480. $sd="kmeleon.general.saveDir";
  1481. $sp="kmeleon.general.savePageDir";
  1482. $si="kmeleon.general.saveImageDir";
  1483. $sld="kmeleon.general.saveLinkDir";
  1484. $dir="kmeleon.general.profileDir";
  1485. $path=getpref(STRING, $dir);
  1486.  
  1487. GetDir{
  1488. $which=getpref(STRING,$el);
  1489. }
  1490. GetDef{
  1491. $el=$sd; $dl="Default"; &GetDir;
  1492. }
  1493. GetPage{
  1494. $el=$sp; $dl="Save Page As"; &GetDir;
  1495. }
  1496. GetImage{
  1497. $el=$si; $dl="Save Image As"; &GetDir;
  1498. }
  1499. GetLink{
  1500. $el=$sld; $dl="Save Link As"; &GetDir;
  1501. }
  1502.  
  1503. Save{
  1504. &GetDef; $oldsave=$which; macros($get); setpref(STRING,$sd,$which); 
  1505. id($id); setpref(STRING,$sd,$oldsave);
  1506. }
  1507.  
  1508. SavePage{
  1509. $get="GetPage"; $id="ID_FILE_SAVE_AS"; &Save; 
  1510. }
  1511.  
  1512. SaveFrame{
  1513. $get="GetPage"; $id="ID_FILE_SAVE_FRAME_AS"; &Save; 
  1514. }
  1515.  
  1516. SaveImage{
  1517. $get="GetImage"; $id="ID_SAVE_IMAGE_AS"; &Save; 
  1518. }
  1519.  
  1520. SaveLink{
  1521. $get="GetLink"; $id="ID_SAVE_LINK_AS"; &Save; 
  1522. }
  1523.  
  1524. SetDir{
  1525. $savetip="Enter Directory Path. (Include backslash at the end of folder name.)";
  1526. $which==""?$which=$path:"";
  1527. $which=prompt($savetip,$dl,$which);
  1528. $which==""?"":setpref(STRING,$el,$which);
  1529. $which==""?"":$savepath=$which; $which==""?"":&AlertSave;
  1530. }
  1531.  
  1532. DefaultDir{
  1533. &GetDef; &SetDir;
  1534. }
  1535.  
  1536. PageDir{
  1537. &GetPage; &SetDir;
  1538. }
  1539.  
  1540. ImageDir{
  1541. &GetImage; &SetDir;
  1542. }
  1543.  
  1544. LinkDir{
  1545. &GetLink; &SetDir;
  1546. }
  1547.  
  1548. AlertSave{
  1549. &GetDef; $def=$which; $dtip=$dl; &GetPage; $page=$which; $ptip=$dl;
  1550. &GetImage; $image=$which; $itip=$dl; &GetLink; $link=$which; $ltip=$dl;
  1551. alert($dtip."  =  ".$def.\n.$ptip."  =  ".$page.\n.$itip."  =  ".$image.\n.$ltip."  =  ".$link, "Download Directories",INFO); 
  1552. }
  1553.  
  1554. # ----MOUSE GESTURES----
  1555.  
  1556. $mouse="kmeleon.plugins.gestures.";
  1557.  
  1558. MGSync{
  1559. setcheck("macros(Gestures)",getpref(BOOL,$mouse."load"));
  1560. }
  1561.  
  1562. Gestures{
  1563. togglepref(BOOL,$mouse."load"); &Sync;
  1564. getpref(BOOL,$mouse."load")==true ? $tip="ENABLED":$tip="DISABLED"; 
  1565. alert("Mouse Gestures will be ".$tip." when K-Meleon is restarted.","Mouse Gestures ".$tip,INFO);
  1566. }
  1567.  
  1568. GestGuide{
  1569. $var=confirm("*M O U S E   G E S T U R E S   C O N F I G U R A T I O N   G U I D E*\n\nThis guide will present a prompt for each available mouse gesture. Each prompt will show the gesture in the title bar. Enter the command or macro that you'd like to use for each gesture. For your convenience, you can copy and paste the command or macro from the available commands list.\n\n\nDo you want to view a list of the available commands and macros to use for the gestures? (Recommended)","MOUSE GESTURES",YESNOCANCEL);
  1570. $var=="YES"? &Commands1st:0; $var=="NO"? &left:0; $var=="CANCEL"?"":0;
  1571. }
  1572. Commands1st{
  1573. &Commands; &left;
  1574. }
  1575.  
  1576. GestCFG{
  1577. $cmd=getpref(STRING,$mouse.$gest);
  1578. $cmd=prompt("Enter ID_COMMAND, PLUGIN COMMAND, or MACRO for this gesture.",$gest,$cmd);
  1579. $cmd==""?"":setpref(STRING,$mouse.$gest,$cmd); 
  1580. $cmd==""?"":confirm($gest."  =  ".$cmd."\n\nConfigure next gesture?","MOUSE GESTURE",YESNO)=="YES"? macros($next):0;
  1581. }
  1582.  
  1583. left{
  1584. $gest="left"; $next="right"; &GestCFG;
  1585. }
  1586. right{
  1587. $gest="right"; $next="down"; &GestCFG;
  1588. }
  1589. down{
  1590. $gest="down"; $next="downleft"; &GestCFG;
  1591. }
  1592. downleft{
  1593. $gest="downleft"; $next="downright"; &GestCFG;
  1594. }
  1595. downright{
  1596. $gest="downright"; $next="up"; &GestCFG;
  1597. }
  1598. up{
  1599. $gest="up"; $next="upleft"; &GestCFG;
  1600. }
  1601. upleft{
  1602. $gest="upleft"; $next="upright"; &GestCFG;
  1603. }
  1604. upright{
  1605. $gest="upright"; $next="left"; &GestCFG;
  1606. }
  1607.  
  1608. # ----CONFIG MACROS----
  1609.  
  1610. $skindir=getpref(STRING,"kmeleon.general.skinsDir");
  1611. $skin=getpref(STRING,"kmeleon.general.skinsCurrent");
  1612.  
  1613. $defaultAction="open";
  1614. $defaultEditor=getpref(STRING,$macroPrefBranch."configCommand");
  1615.  
  1616. getExtensionHandler{
  1617. $defaultEditor==""?$defaultEditor="notepad.exe %1":"";
  1618. $doctype=readreg("HKCR",".".$ext."\\");
  1619. $doctype==""?$cmdline=$defaultEditor:$cmdline=""; $shell="\\shell\\"; $command="\\command\\";
  1620. $cmdline==""?$defactn=readreg("HKCR",$doctype.$shell):"";
  1621. $cmdline==""?($defactn==""?$cmdline=readreg("HKCR",$doctype.$shell.$defaultAction.$command):$cmdline=readreg("HKCR",$doctype.$shell.$defactn.$command)):"";
  1622. # DDE is not supported here:
  1623. index($cmdline,"%1")?"":$cmdline=$defaultEditor;
  1624. $doctype=readreg("HKCR",$doctype."\\"); $doctype==""?$doctype=sub("%s",$ext,_("%s File")):"";
  1625. $defaultAction="open";
  1626. }
  1627.  
  1628. getSecureExtensionHandler{
  1629. # use for script files
  1630. $defaultAction="edit"; &getExtensionHandler;
  1631. }
  1632.  
  1633. Commands{
  1634. $ext="txt"; &getExtensionHandler; exec(sub("%1",$skindir."commands.txt",$cmdline));
  1635. }
  1636. Toolbars{
  1637. $ext="cfg"; &getExtensionHandler; exec(sub("%1",$skindir.$skin."toolbars.cfg",$cmdline));
  1638. }
  1639. Macros{
  1640. exec("notepad.exe ".$path."macros.cfg");
  1641. }
  1642. Menus{
  1643. exec("notepad.exe ".$path."menus.cfg");
  1644. }
  1645. Accel{
  1646. exec("notepad.exe ".$path."accel.cfg");
  1647. }
  1648. Prefs{
  1649. #exec("notepad.exe ".$path."prefs.js");
  1650. $ext="js"; &getSecureExtensionHandler; exec(sub("%1",$path."prefs.js",$cmdline));
  1651. }
  1652. User{
  1653. $ext="js"; &getSecureExtensionHandler; exec(sub("%1",$path."user.js",$cmdline));
  1654. }
  1655. UserContent{
  1656. $ext="css"; &getExtensionHandler; exec(sub("%1",$path."chrome\\userContent.css",$cmdline));
  1657. }
  1658.  
  1659. CSSFilters{
  1660. $ext="css"; &getExtensionHandler; exec(sub("%1",$path."\chrome\\adblock.css",$cmdline));
  1661. }
  1662. GestureCmds{
  1663. $ext="cfg"; &getExtensionHandler; exec(sub("%1",$path."gestures.cfg",$cmdline));
  1664. }
  1665.  
  1666. ProfD{
  1667. exec("explorer.exe \"".$path."\"");
  1668. }
  1669.  
  1670. JSConsole{
  1671. # Default Console:
  1672. #$xul="chrome://global/content/console.xul"; &XULDialog;
  1673. # Console2:
  1674. $xul="chrome://console2/content/console2.xul"; &XULDialog;
  1675. }
  1676.  
  1677. XULDialog{
  1678. opennew($xul);
  1679. }
  1680.  
  1681. XUL{
  1682. $layer==true ? pluginmsg(layers,OpenURL,$xul):opennew($xul);
  1683. }
  1684. AllPrefs{
  1685. $xul="about:config"; &XUL;
  1686. }
  1687. RSS{
  1688. $macro="rss"; &Frm1st;
  1689. }
  1690. rss{
  1691. $xul="chrome://aggreg8/content/aggreg8.xul"; &XUL;
  1692. }
  1693. Flashblock{
  1694. $xul="chrome://flashblock/content/options.xul"; &XUL;
  1695. }
  1696. Quicknote{
  1697. $xul = "chrome://quicknote/content/quicknote.xul"; &XUL;
  1698. }
  1699. Master{
  1700. $xul="chrome://pippki/content/pref-masterpass.xul"; &XULDialog;
  1701. }
  1702. Cert{
  1703. $xul="chrome://pippki/content/certManager.xul"; &XULDialog;
  1704. }
  1705.  
  1706. # ----MISC. MACROS----
  1707.  
  1708. SetHome{
  1709. setpref(STRING,"kmeleon.general.homePage",$URL);
  1710. setpref(INT,$sg,0); setpref(BOOL,$sh,true); &Sync;
  1711. alert(sub("%s",$TITLE,_("'%s'  is now your Home Page.")),_("Home Page Updated"),INFO);
  1712. }
  1713.  
  1714. KMWiki{
  1715. open("http://kmeleon.sourceforge.net/wiki/index.php?id=Welcome");
  1716. }
  1717.  
  1718. LinkInfo {
  1719. confirm($LinkURL."\n\n\nDo you want to go to this address now?","URL OF SELECTED LINK:",YESNO)=="YES"? open($LINKURL):"";
  1720. }
  1721.  
  1722. ListLinks{
  1723. $macro="ViewPageLinks";&PBDisable;
  1724. }
  1725.  
  1726. ListFrameLinks{
  1727. $macro="ViewFrameLinks";&PBDisable;
  1728. }
  1729.  
  1730. PBDisable{
  1731. getpref(BOOL,$popups)==true ? &PB:macros($macro);
  1732. }
  1733.  
  1734. PB{
  1735. &PBToggle; macros($macro); &PBToggle;
  1736. }
  1737.  
  1738. ViewLinks{
  1739. $JSfunc="var h='kmHOST',l='kmLINK',w=window.name,n=(w&&!document.getElementsByTagName('body')[0])?w.replace(h,''):Math.floor(Math.random()*1000),hostWinName=window.name=h+n,linkWinName=l+n,linkWin=open('',linkWinName,'left=0,top=0,width=600,height=300,status=yes');linkWin.document.write('<head><base target=\"'+hostWinName+'\"><link rel=\"stylesheet\" type=\"text/css\" href=\"'+encodeURI('".$macroResLoc."')+'macros.css\">');with(document)linkWin.document.write('<title>"._("Page Links:")." '+((title)?title:unescape(URL))+'</title></head><body class=\"kmViewLinks\">');";
  1740. $JSdoit="if(getElementsByTagName('body')[0]){var d=linkWin.document;d.write('<fieldset><legend>'+((title)?title:unescape(URL)).link(URL)+'</legend><ol>');if(links.length)for(var j=0;j<links.length;j++)d.write('<li>'+((links[j].text)?links[j].text.link(links[j]):unescape(links[j]).link(links[j]))+'</li>');else d.write('<p>"._("No links found.")."</p>');d.write('</ol></fieldset>')}";
  1741. $JSlast="linkWin.document.write('</body>');linkWin.document.close();linkWin.focus()";
  1742. }
  1743.  
  1744. ViewPageLinks{
  1745. &ViewLinks; &hndlDocs;
  1746. }
  1747.  
  1748. ViewFrameLinks{
  1749. &ViewLinks; &hndlDoc;
  1750. }
  1751.  
  1752. FrameInLayer{
  1753. pluginmsg(layers,OpenURL,$FRAMEURL);
  1754. }
  1755.  
  1756. FrameInBack{
  1757. $layer==true ? pluginmsg(layers,OpenURLBg,$FRAMEURL):OpenBg($FRAMEURL);
  1758. }
  1759.  
  1760. ReloadFrame{
  1761. $JSdoit="location.reload()"; &hndlDoc;
  1762. }
  1763.  
  1764. getIE{
  1765. $ie=readreg("HKCR","Applications\\iexplore.exe\\shell\\open\\command\\");
  1766. $ie==""?$ie="\"C:\\Program Files\\Internet Explorer\\iexplore.exe\" %1":"";
  1767. }
  1768. URLInIE{
  1769. $theurl=$URLBAR;
  1770. $theurl==""? $theurl=$URL:"";
  1771. &getIE; exec(sub("%1",$theurl,$ie));
  1772. }
  1773. LinkInIE{
  1774. &getIE; exec(sub("%1",$LINKURL,$ie));
  1775. }
  1776.  
  1777. Active_X{
  1778. $plug="npmozax.dll";
  1779. $reload = true;
  1780. &toggleplug;
  1781. }
  1782. toggleplug{
  1783. $plugpath = "plugins\\";
  1784. $plug_activ = getpref(BOOL,"kmeleon.netplug.".$plug);
  1785. $plug_activ ? $verb = "to disable " : $verb = "to enable ";
  1786. $plug_activ ? $action = "disabling " : $action = "Enabling ";
  1787. $plug_activ ? $from = $plugpath . $plug : $from = $plugpath . "_" . $plug;
  1788. $plug_activ ? $to = $plugpath . "_" . $plug : $to = $plugpath . $plug;
  1789. $x = pluginmsg(utils, "rename", $from, $to);
  1790. togglepref(BOOL,"kmeleon.netplug.".$plug);
  1791. &Sync;
  1792. $msg = "You have to close and restart K-Ninja " . $verb . "the plugin " . $plug
  1793. $reload ? alert($msg,$action."of a Netscape plugin") : 0;
  1794. }
  1795.  
  1796. STP{
  1797. exec("c:\\Program Files\\K-Ninja2\\Tools\\STP\\STP.exe ");
  1798. }
  1799.  
  1800. Continuous{
  1801. getpref(BOOL,$jscript)==false ? (confirm(_("JavaScript is currently disabled. It must be enabled to use this feature.")."\n\n\n"._("Enable JavaScript and continue?"),_("JavaScript Disabled"),YESNO,EXCLAIM)=="YES" ? &JS1st:""):&Reload;
  1802. }
  1803. JS1st{
  1804. &JSToggle; &Reload;
  1805. }
  1806. Reload{
  1807. open("javascript:(function(){var intv=prompt('Enter number of seconds between reloads. (Click Back button to stop)');if(intv&&!isNaN(intv)){with(document){write('<html><frameset rows=\"*,22\" framespacing=0 border=0 frameborder=no><frame noresize frameborder=no><frame scrolling=no noresize frameborder=no></frameset></html>');frames[0].location.href=document.location.href;var docstr='<html><body bgcolor=cyan style=\"margin-top:0px\">\n';docstr+='Reloading in <span id=\"caption\"></span>secs.</body>\n';docstr+='<script>\nvar reloadIntv='+intv+';\nvar secsLeft='+intv+';\nfunction reloadFrame(){secsLeft=reloadIntv+1;parent.frames[0].location.href=parent.frames[0].location.href;}\nfunction countDown(){secsLeft--;showTime();}\nfunction showTime(){document.getElementById(\"caption\").innerHTML=parseInt(secsLeft)+\" \";}\nsetInterval(\"reloadFrame()\",'+intv*1000+');\nsetInterval(\"countDown()\",1000);\nshowTime();\n</script>\n</html>';frames[1].document.write(docstr);}}})()");
  1808. }
  1809.  
  1810.  
  1811. # Multi Search ------------------------------------------------------------------
  1812.  
  1813. MultiSearch{
  1814. $data=$SelectedText; $data==""?&MetaTyped:&MetaSelected;
  1815. }
  1816. MetaSelected{
  1817. $pref=$openSelected; &MetaOpen;
  1818. }
  1819. MetaTyped{
  1820. $pref=$openTyped;
  1821. $data=$URLBAR; $data==$URL?$data=prompt(_("Enter search query:"),sub("%s",_("MultiSearch - Multiple Search Engines"),_("Search (%s)"))):0; 
  1822. $data==""?0:&MetaOpen;
  1823. }
  1824. MetaOpen{
  1825. $how=getpref(STRING,$pref); $data=urlencode($data);
  1826. $how=="ID_OPEN_LINK"?$how=0:0; 
  1827. $how=="ID_OPEN_LINK_IN_NEW_WINDOW"?$how=0:0; 
  1828. $how=="ID_OPEN_LINK_IN_BACKGROUND"?$how=1:0; 
  1829. $how=="layers(OpenURL)"?$how=0:0; 
  1830. $how=="layers(OpenURLBg)"?$how=1:0; 
  1831. &ResetURL; $n=0; while($n!=10) &MetaLoop;
  1832. }
  1833. MetaLoop{
  1834. $SearchEngineURL=getpref(STRING,$sm.$n.".url");
  1835. $SearchEngineURL==""?0:$how==0?($layer==true?pluginmsg(layers,"OpenURL",$SearchEngineURL.$data):opennew($SearchEngineURL.$data)):0;
  1836. $SearchEngineURL==""?0:$how==1?($layer==true?pluginmsg(layers,"OpenURLBg",$SearchEngineURL.$data):OpenBg($SearchEngineURL.$data)):0;
  1837. $n=$n+1;
  1838. }
  1839.  
  1840.  
  1841.  
  1842. # TRANSLATION MACROS
  1843.  
  1844. $prefix = "";
  1845.  
  1846. translate{
  1847. $LINKURL = ""; $LINKURL == "" ? $theurl = $URL : $theurl = $LINKURL;
  1848. $prefix == "" ? open($lang . $theurl) : open($prefix . $theurl . $suffix);
  1849. }
  1850. german{
  1851. menu=From German
  1852. $lang = "http://216.239.37.104/translate_c?hl=en&ie=UTF-8&oe=UTF-8&langpair=de%7Cen&u=";
  1853. &translate;
  1854. }
  1855. spanish{
  1856. menu=From Spanish
  1857. $lang = "http://216.239.37.104/translate_c?hl=en&ie=UTF-8&oe=UTF-8&langpair=es%7Cen&u=";
  1858. &translate;
  1859. }
  1860. french{
  1861. menu=From French
  1862. $lang = "http://216.239.37.104/translate_c?hl=en&ie=UTF-8&oe=UTF-8&langpair=fr%7Cen&u=";
  1863. &translate;
  1864. }
  1865. italian{
  1866. menu=From Italian
  1867. $lang = "http://216.239.37.104/translate_c?hl=en&ie=UTF-8&oe=UTF-8&langpair=it%7Cen&u=";
  1868. &translate;
  1869. }
  1870. portuguese{
  1871. menu=From Portuguese
  1872. $lang = "http://216.239.37.104/translate_c?hl=en&ie=UTF-8&oe=UTF-8&langpair=pt%7Cen&u=";
  1873. &translate;
  1874. }
  1875. russia{
  1876. menu=From Russian
  1877. $prefix="http://babelfish.altavista.com/babelfish/urltrurl?tt=url&url=http%3A%2F%2F";
  1878. $suffix="%2F&lp=ru_en";
  1879. &translate; $prefix = "";
  1880. }
  1881. china{
  1882. menu=From Chinese
  1883. $prefix="http://babelfish.altavista.com/babelfish/urltrurl?tt=url&url=http%3A%2F%2F";
  1884. $suffix="%2F&lp=zh_en";
  1885. &translate; $prefix = "";
  1886. }
  1887. japan{
  1888. menu=From Japanese
  1889. $prefix="http://babelfish.altavista.com/babelfish/urltrurl?tt=url&url=http%3A%2F%2F";
  1890. $suffix="%2F&lp=ja_en";
  1891. &translate; $prefix = "";
  1892. }
  1893. korea{
  1894. menu=From Korean
  1895. $prefix="http://babelfish.altavista.com/babelfish/urltrurl?tt=url&url=http%3A%2F%2F";
  1896. $suffix="%2F&lp=ko_en";
  1897. &translate; $prefix = "";
  1898. }
  1899. netherlands{
  1900. menu=From Dutch
  1901. $lang = "http://www.tranexp.com:2000/Translate/index.shtml?from=dut&to=eng&type=url&url=";
  1902. &translate;
  1903. }
  1904. finland{
  1905. menu=From Finnish
  1906. $lang = "http://www.tranexp.com:2000/Translate/index.shtml?from=fin&to=eng&type=url&url=";
  1907. &translate;
  1908. }
  1909. greece{
  1910. menu=From Greek
  1911. $lang = "http://www.tranexp.com:2000/Translate/index.shtml?from=grk&to=eng&type=url&url=";
  1912. &translate;
  1913. }
  1914.  
  1915. #--- Shortcut Key macros ----------#
  1916. SETCTRL1{
  1917. $ctrl1=prompt("Enter Address for CTRL + 1", "CTRL + 1");
  1918. setpref(STRING, "Web.address.CTRL1", $ctrl1);
  1919. }
  1920. SETCTRL2{
  1921. $ctrl2=prompt("Enter Address for CTRL + 2", "CTRL + 2");
  1922. setpref(STRING, "Web.address.CTRL2", $ctrl2);
  1923. }
  1924. SETCTRL3{
  1925. $ctrl3=prompt("Enter Address for CTRL + 3", "CTRL + 3");
  1926. setpref(STRING, "Web.address.CTRL3", $ctrl3);
  1927. }
  1928. SETCTRL4{
  1929. $ctrl4=prompt("Enter Address for CTRL + 4", "CTRL + 4");
  1930. setpref(STRING, "Web.address.CTRL4", $ctrl4);
  1931. }
  1932. SETCTRL5{
  1933. $ctrl5=prompt("Enter Address for CTRL + 5", "CTRL + 5");
  1934. setpref(STRING, "Web.address.CTRL5", $ctrl5);
  1935. }
  1936. SETCTRL6{
  1937. $ctrl6=prompt("Enter Address for CTRL + 6", "CTRL + 6");
  1938. setpref(STRING, "Web.address.CTRL6", $ctrl6);
  1939. }
  1940. SETCTRL7{
  1941. $ctrl7=prompt("Enter Address for CTRL + 7", "CTRL + 7");
  1942. setpref(STRING, "Web.address.CTRL7", $ctrl7);
  1943. }
  1944. SETCTRL8{
  1945. $ctrl8=prompt("Enter Address for CTRL + 8", "CTRL + 8");
  1946. setpref(STRING, "Web.address.CTRL8", $ctrl8);
  1947. }
  1948. SETCTRL9{
  1949. $ctrl9=prompt("Enter Address for CTRL + 9", "CTRL + 9");
  1950. setpref(STRING, "Web.address.CTRL9", $ctrl9);
  1951. }
  1952. CTRL1{
  1953. $ctrl1=getpref(STRING,"Web.address.CTRL1");
  1954. open($ctrl1);
  1955. }
  1956. CTRL2{
  1957. $ctrl2=getpref(STRING,"Web.address.CTRL2");
  1958. open($ctrl2);
  1959. }
  1960. CTRL3{
  1961. $ctrl3=getpref(STRING,"Web.address.CTRL3");
  1962. open($ctrl3);
  1963. }
  1964. CTRL4{
  1965. $ctrl4=getpref(STRING,"Web.address.CTRL4");
  1966. open($ctrl4);
  1967. }
  1968. CTRL5{
  1969. $ctrl5=getpref(STRING,"Web.address.CTRL5");
  1970. open($ctrl5);
  1971. }
  1972. CTRL6{
  1973. $ctrl6=getpref(STRING,"Web.address.CTRL6");
  1974. open($ctrl6);
  1975. }
  1976. CTRL7{
  1977. $ctrl7=getpref(STRING,"Web.address.CTRL7");
  1978. open($ctrl7);
  1979. }
  1980. CTRL8{
  1981. $ctrl8=getpref(STRING,"Web.address.CTRL8");
  1982. open($ctrl8);
  1983. }
  1984. CTRL9{
  1985. $ctrl9=getpref(STRING,"Web.address.CTRL9");
  1986. open($ctrl9);
  1987. }
  1988.  
  1989. Hyperlink_in_Layer {
  1990.                      $tmp = getclipboard();
  1991.                      id(ID_EDIT_COPY);
  1992.                      pluginmsg(layers, "OpenURL", getclipboard());
  1993.                      setclipboard($tmp);
  1994.                    }
  1995.  
  1996. # K-Ninja Menu Macros
  1997.  
  1998. kninjafaq{
  1999. pluginmsg(layers, "OpenURL", "http://www.geocities.com/grenleef/faq.html");
  2000. }
  2001.  
  2002. knhome{
  2003. pluginmsg(layers, "OpenURL", "http://geocities.com/grenleef");
  2004. }
  2005.  
  2006. knforums{
  2007. pluginmsg(layers, "OpenURL", "http://pub35.bravenet.com/forum/2994087922");
  2008. }
  2009.  
  2010. mzhome{
  2011. pluginmsg(layers, "OpenURL", "http://www.mozillazine.org/");
  2012. }
  2013.  
  2014. MZWiki{
  2015. pluginmsg(layers, "OpenURL", "http://wiki.mozilla.org/Main_Page");
  2016. }
  2017.  
  2018. mzforums{
  2019. pluginmsg(layers, "OpenURL", "http://forums.mozillazine.org/viewforum.php?f=34&sid=7c688285a71430afedf4c6d666d93f32");
  2020. }
  2021.  
  2022. MZ{
  2023. pluginmsg(layers, "OpenURL", "http://forums.mozillazine.org/search.php");
  2024. }
  2025.  
  2026. # ---kko--- Custom Proxies !
  2027.  
  2028. $proxy="network.proxy.";
  2029. $cprxy=$macroPrefBranch."proxy";
  2030.  
  2031. proxy1cfg{
  2032. $n="1"; &CPset;
  2033. }
  2034. proxy2cfg{
  2035. $n="2"; &CPset;
  2036. }
  2037. proxy3cfg{
  2038. $n="3"; &CPset;
  2039. }
  2040.  
  2041. ProxySync{
  2042. setcheck("macros(proxy1)",(getpref(STRING,$cprxy."1.http")==getpref(STRING,$proxy."http"))*(getpref(INT,$proxy."type")==1)?true:false);
  2043. setcheck("macros(proxy2)",(getpref(STRING,$cprxy."2.http")==getpref(STRING,$proxy."http"))*(getpref(INT,$proxy."type")==1)?true:false);
  2044. setcheck("macros(proxy3)",(getpref(STRING,$cprxy."3.http")==getpref(STRING,$proxy."http"))*(getpref(INT,$proxy."type")==1)?true:false);
  2045. setcheck("macros(NoProxy)",getpref(INT,$proxy."type")?false:true);
  2046. }
  2047.  
  2048. CPset{
  2049. $tit=sub("%s",$n,_("Custom HTTP Proxy %s - Server Setup"));
  2050. $srvr=getpref(STRING,$cprxy.$n.".http");
  2051. $port=getpref(INT,$cprxy.$n.".http_port");
  2052. $srvr=prompt(_("Server URL:"),$tit,$srvr);
  2053. $srvr==""?"":setpref(STRING,$cprxy.$n.".http",$srvr);
  2054. $srvr==""?"":$port=prompt(_("Server Port:"),$tit,$port);
  2055. $port==""?"":setpref(INT,$cprxy.$n.".http_port",$port);
  2056. statusbar(_("Custom HTTP Proxy")." ".$n." ".getpref(STRING,$cprxy.$n.".http").":".getpref(INT,$cprxy.$n.".http_port"));
  2057. }
  2058.  
  2059. proxy1{
  2060. $n="1"; &CPuse;
  2061. }
  2062. proxy2{
  2063. $n="2"; &CPuse;
  2064. }
  2065. proxy3{
  2066. $n="3"; &CPuse;
  2067. }
  2068.  
  2069. CPuse{
  2070. $srvr=getpref(STRING,$cprxy.$n.".http");
  2071. $port=getpref(INT,$cprxy.$n.".http_port");
  2072. # When no server url is set, do not change anything!
  2073. $srvr==""?"":setpref(STRING,$proxy."http",$srvr);
  2074. $srvr==""?"":setpref(INT,$proxy."http_port",$port);
  2075. $srvr==""?"":setpref(INT,$proxy."type",1);
  2076. getpref(INT,$proxy."type")==1?statusbar(_("Connecting over proxy")." ".getpref(STRING,$proxy."http").":".getpref(INT,$proxy."http_port")):&NoProxy;
  2077. &Sync;
  2078. }
  2079.  
  2080. NoProxy {
  2081. setpref(INT,$proxy."type",0);
  2082. statusbar(_("Direct Connection"));
  2083. &Sync;
  2084. }
  2085.  
  2086. # ---kko--- Hotlinks
  2087. #
  2088. $hl=$macroPrefBranch."hotlink";
  2089.  
  2090. hotlink0{
  2091. $n="0"; &HLgo;
  2092. }
  2093. hotlink1{
  2094. $n="1"; &HLgo;
  2095. }
  2096. hotlink2{
  2097. $n="2"; &HLgo;
  2098. }
  2099. hotlink3{
  2100. $n="3"; &HLgo;
  2101. }
  2102. hotlink4{
  2103. $n="4"; &HLgo;
  2104. }
  2105. hotlink5{
  2106. $n="5"; &HLgo;
  2107. }
  2108. hotlink6{
  2109. $n="6"; &HLgo;
  2110. }
  2111. hotlink7{
  2112. $n="7"; &HLgo;
  2113. }
  2114. hotlink8{
  2115. $n="8"; &HLgo;
  2116. }
  2117. hotlink9{
  2118. $n="9"; &HLgo;
  2119. }
  2120.  
  2121. HLgo{
  2122. &HLgetPref; $newwin==true?$xul=$theurl:$xul="";
  2123. $xul==""?($theurl==""?"":open($theurl)):($theurl==""?"":&XUL);
  2124. }
  2125.  
  2126. hotlink0cfg{
  2127. $n="0"; &HLsetURL;
  2128. }
  2129. hotlink1cfg{
  2130. $n="1"; &HLsetURL;
  2131. }
  2132. hotlink2cfg{
  2133. $n="2"; &HLsetURL;
  2134. }
  2135. hotlink3cfg{
  2136. $n="3"; &HLsetURL;
  2137. }
  2138. hotlink4cfg{
  2139. $n="4"; &HLsetURL;
  2140. }
  2141. hotlink5cfg{
  2142. $n="5"; &HLsetURL;
  2143. }
  2144. hotlink6cfg{
  2145. $n="6"; &HLsetURL;
  2146. }
  2147. hotlink7cfg{
  2148. $n="7"; &HLsetURL;
  2149. }
  2150. hotlink8cfg{
  2151. $n="8"; &HLsetURL;
  2152. }
  2153. hotlink9cfg{
  2154. $n="9"; &HLsetURL;
  2155. }
  2156.  
  2157. HLgetPref{
  2158. $theurl=getpref(STRING,$hl.$n.".url");
  2159. $newwin=getpref(BOOL,$hl.$n.".new");
  2160. }
  2161. HLsetURL{
  2162.  
  2163. &HLgetPref; $tit=_("Hotlinks"); $tip=gsub("%s", $n, _("On Ctrl+%s open:'));
  2164. # suggest current URL, if not set:
  2165. $theurl=prompt($tip,$tit,$theurl==""?$URL:$theurl);
  2166. $theurl==""?"":setpref(STRING,$hl.$n.".url",$theurl);
  2167. $theurl==""?"":&HLsetNEW;
  2168. }
  2169. HLsetNEW{
  2170. $newwin=confirm(_("Do you want to open this hotlink in a new window/layer?"),$tit,YESNO,QUESTION);
  2171. $newwin=="YES"?setpref(BOOL,$hl.$n.".new",true):setpref(BOOL,$hl.$n.".new",false);
  2172. }
  2173.  
  2174. # ----- XUL Pref Panel Macros ---------------------------------------------------------------
  2175.  
  2176. $frames="browser.frames.enabled";
  2177.  
  2178. Frm1st{
  2179. getpref(BOOL,$frames)==false?(confirm(_("Frames are currently disabled. They must be enabled to use this feature.")."\n\n"._("Enable Frames and continue?"),_("Frames Disabled"),YESNO,EXCLAIM)=="YES"?&Frm2nd:""):macros($macro);
  2180. }
  2181. Frm2nd{
  2182. &FrmToggle; macros($macro);
  2183. }
  2184. FrmToggle{
  2185. togglepref(BOOL,$frames); &Sync;
  2186. getpref(BOOL,$frames)==false?$tip=_("BLOCKED"):$tip=_("ALLOWED");
  2187. statusbar(_("Frames")." ".$tip);
  2188. }
  2189.  
  2190. $prefURL="chrome://kmprefs/content/pref.xul";
  2191.  
  2192. PrefOpen{
  2193. $macro="XULDialog"; &Frm1st;
  2194. }
  2195. PrefPanel{
  2196. $xul=$prefURL; &PrefOpen;
  2197. }
  2198. Bookmarks{
  2199. $xul=$prefURL."?bookmarks"; &PrefOpen;
  2200. }
  2201. Favorites{
  2202. $xul=$prefURL."?favorites"; &PrefOpen;
  2203. }
  2204. Hotlist{
  2205. $xul=$prefURL."?hotlist"; &PrefOpen;
  2206. }
  2207. Browsing{
  2208. $xul=$prefURL."?browsing"; &PrefOpen;
  2209. }
  2210. Filters{
  2211. $xul=$prefURL."?filters"; &PrefOpen;
  2212. }
  2213. Hotlinks{
  2214. $xul=$prefURL."?hotlinks"; &PrefOpen;
  2215. }
  2216. MGestures{
  2217. $xul=$prefURL."?gestures"; &PrefOpen;
  2218. }
  2219. Layers{
  2220. $xul=$prefURL."?layers"; &PrefOpen;
  2221. }
  2222. JavaScript{
  2223. $xul=$prefURL."?javascript"; &PrefOpen;
  2224. }
  2225. ToolBars{
  2226. $xul=$prefURL."?toolbars"; &PrefOpen;
  2227. }
  2228.  
  2229. getFavorites{
  2230. $fav="kmeleon.plugins.favorites.directory";
  2231. $tmp=readreg("HKCU","Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders\\Favorites")."\\";
  2232. getpref(STRING,$fav)==""?setpref(STRING,$fav,$tmp):"";
  2233. }
  2234.  
  2235.  
  2236. # ----- 
  2237.  
  2238. UserCSS{
  2239. $ext="css"; &getExtensionHandler;
  2240. injectCSS(readfile(promptforfile("", $doctype, "*.css")))
  2241. }
  2242.  
  2243. UserScript{
  2244. $ext="js"; &getExtensionHandler;
  2245. injectJS(readfile(promptforfile("", $doctype, "*.js")))
  2246. }
  2247.